I have the following template function:
template<typename T>
T test_function(T arg) {return arg;}
I can create a specialized version of this for integers with:
template<>
int test_function(int arg) {return arg;}
This is practical if I use this function with integers a lot. So I can call it with:
test_function(some_integer); // easy!
test_function<int>(some_integer); // not necessary all the time.
Now I have the following class:
template<typename T>
class Foo
{
public:
Foo();
};
I want to be able to call it with:
Foo foo1; // how do I do this?
Foo<int> foo2; // I don't want to use this all the time.
How can I define this class in order to be able to create an instance of it without using angle brackets at all? Shouldn't be too hard I think, but I couldn't figure it out so far...