I am trying to make a class where the constructor takes in a parameter of a type corresponding to a typedefinition defined in the templated class. Please see the following illustrational snippet which does not compile.
class A
{
typedef enum test_t {
a1,
a2,
a3
} test_t;
};
template <class T>
class B
{
B(T::test_t obj);
};
template <class T>
B<T>::B(T::test_t obj)
{
}
// Explicit definition to let compiler know a template instantiation
template class B<A>;
When compiling this code I get the following errors:
TemplatedClassTest.cpp:13:14: error: expected ‘)’ before ‘obj’
TemplatedClassTest.cpp:17:8: error: expected constructor, destructor, or type conversion before ‘(’ token