If I am allowed to do the following:
template <typename T = int>
class Foo{
};
Why am I not allowed to do the following in main?
Foo me;
But I must specify the following:
Foo<int> me;
C++11 introduced default template arguments and right now they are being elusive to my complete understanding.
Foo
might be a template identifier or might be an explicit instantiation depending on whether there's a default argument. Better keep the explicit instantiation syntax. Think of it like a functionfoo
with a single default parameter. You can't call it likefoo
, you call it withfoo()
. It makes sense to keep this consistent. – Somerset