Compilation Error on Recursive Variadic Template Function
Posted
by
Maxpm
on Stack Overflow
See other posts from Stack Overflow
or by Maxpm
Published on 2011-02-17T23:12:22Z
Indexed on
2011/02/17
23:25 UTC
Read the original article
Hit count: 265
I've prepared a simple variadic template test in Code::Blocks, but I'm getting an error:
No matching function for call to 'OutputSizes()'
Here's my source code:
#include <iostream>
#include <typeinfo>
using namespace std;
template <typename FirstDatatype, typename... DatatypeList>
void OutputSizes()
{
std::cout << typeid(FirstDatatype).name() << ": " << sizeof(FirstDatatype) << std::endl;
OutputSizes<DatatypeList...>();
}
int main()
{
OutputSizes<char, int, long int>();
return 0;
}
I'm using GNU GCC with -std=C++0x
. Using std=gnu++0x
makes no difference.
© Stack Overflow or respective owner