template<typename T> struct function { typedef T type; template<typename U> static void f() {} }; template<typename T> struct caller { int count; caller(): count() {} void operator()() { count++; T::f<typename T::type>(); } }; int main() { caller<function<int> > call; call(); return 0; }
This seems right to me, but the compiler gives this ugly error, which I cannot understand:
prog.cpp: In the member function 'void caller :: operator () ():
prog.cpp: 17: error: expected `('before'> token
prog.cpp: 17: error: expected primary expression before ') token
For your convenience, the code is posted here β http://www.ideone.com/vtP7G
c ++ templates
Nawaz
source share