Compilation Error on Recursive Variadic Template Function
- by Maxpm
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.