I do not understand why this code is not valid:
#include <vector>
template <typename T>
class A{
public:
A() { v.clear(); }
std::vector<A<T> *>::const_iterator begin(){
return v.begin();
}
private:
std::vector<A<T> *> v;
};
When compiling it with gcc, it get the following error:
test.cpp:8: error: type 'std::vector<A<T>*, std::allocator<A<T>*> >' is not derived from type 'A<T>'
test.cpp:8: error: expected ';' before 'begin'
test.cpp:12: error: expected `;' before 'private'
What is wrong, and how to fix it??