The following code snippet works for me:
class Foo { public: template <class T> T& get () { ... } }; Foo foo; foo.get<int>() = ...;
However, the following code fragment does not work for me:
class Foo { public: template <class T> T& operator() () { ... } }; Foo foo; foo<int>() = ...;
Errors:
expected primary-expression before '>' token expected primary expression before ')' token
Both errors relate to foo<int>()
Why does this not work, and can it be fixed?
c ++ operator-overloading templates
Dan
source share