C
Chris Dams
Dear all,
The following is accepted by the compiler
template <class T> class test
{ public:
typedef vector<int>::reference rt;
};
but after the change int -> T, obtaining the code fragment,
template <class T> class test
{ public:
typedef vector<T>::reference rt;
};
the compiler (g++ 4.0.2) says
test.C:8: error: type std::vector<T, std::allocator<_CharT> > is not derived from type test<T>
test.C:8: error: expected ; before rt
Can anyone explain why this happens and how I actually can use
vector<T>::reference in my class? I need it because T can also be bool and
vector<bool> has a different implementation.
Many thanks,
Chris
The following is accepted by the compiler
template <class T> class test
{ public:
typedef vector<int>::reference rt;
};
but after the change int -> T, obtaining the code fragment,
template <class T> class test
{ public:
typedef vector<T>::reference rt;
};
the compiler (g++ 4.0.2) says
test.C:8: error: type std::vector<T, std::allocator<_CharT> > is not derived from type test<T>
test.C:8: error: expected ; before rt
Can anyone explain why this happens and how I actually can use
vector<T>::reference in my class? I need it because T can also be bool and
vector<bool> has a different implementation.
Many thanks,
Chris