I have come across this piece of code (I\'m trying to include all details in case I\'m missing something):
template< typename TYPE = TYPE_with_an_arbitrar
A function-template may not be the best construct to demonstrate default template arguments. Here's something similar with template-structs:
#include
#include
template
struct foo {
static void f() {
std::cout << typeid(T).name() << "\t";
}
};
template
struct bar {
static void f() {
std::cout << typeid(T).name() << "\t";
}
};
int main() {
foo<>::f(); foo::f(); foo::f(); std::cout << std::endl;
bar<>::f(); bar::f(); bar::f(); std::cout << std::endl;
}
Running this, I get:
% ./a.out
i i d
d i d