When can you omit the C++ template argument list? For example in Visual Studio 2010 this piece of code compiles fine:
template
Vec2 V
Inside a class you can omit the argument on the class type:
template<typename K>
struct A {
A<K> foo1; // legal
A foo2; // also legal and identical to A<K> foo
A bar(A x) {...} // same as A<K> bar(A<K> x) {...}
};
Outside of a class scope you need the template arguments:
// legal
template<typename K>
A<K> foo(A<K> x) { return A<K>(); }
// illegal!
template<typename K>
A foo(A x) { return A(); }
If you declare a member function outside the class, you need the template list for the return type and for the class:
// legal
template<typename K>
A<K> A<K>::bar(A<K> x) { return A<K>(x); }
// legal
template<typename K>
A<K> A<K>::bar(A x) { return A(x); }
// illegal!
template<typename K>
A A::bar(A<K> x) { return A<K>(x); }