Hello everyone,
I'm having problems with this code:
#include <vector>
using namespace std;
template <class Type>
class Some
{
private:
vector<Type> elements;
vector<Type>::size_type index; //THIS IS WRONG
public:
Some() { }
};
int main()
{
}
It doesn't compile, giving me
p.cpp:9: error: type ‘std::vector<Type, std::allocator<_Tp1> >’ is not derived from type ‘Some<Type>’
while this code (after changing Type to int) compiles
#include <vector>
using namespace std;
template <class Type>
class Some
{
private:
vector<Type> elements;
vector<int>::size_type index; //Type changed to int
public:
Some() { }
};
int main()
{
}
What's wrong?
Thanks in advance.