I'm trying to write a class with a member fuction that returns an object of a type that's defined in one of the parameters.
Something like this:
T in this case would be an object of this class:
typename T::name op(const T& o)
with any random class used as the template parameter of TI
typedef T name;
I'm using this:
when I try to use it like this
gcc gives the following errors:
#include "ideas2.h" // that's where the class definitions are
/* other stuff I'm trying (currently commented out) removed */
gcc says to use typename, but I'm already using it and if I remove it it says this instead:
ideas2.h: In member function 'typename T::name J::op(const T&) [with T = TI<I>]':
test.cpp:36: instantiated from here
ideas2.h:20: error: dependent-name 'T::name' is parsed as a non-type, but instantiation yields a type
ideas2.h:20: note: say 'typename T::name' if a type is meant
ideas2.h:18: error: expected constructor, destructor, or type conversion before 'op'
test.cpp: In function 'int main()':
test.cpp:36: error: 'class J' has no member named 'op'