The following code excerpt is responsible for a cryptic MSVC++ compiler error:
template<class T> class Vec : public vector<T>{
public:
Vec() : vector<T>(){}
Vec(int s) : vector<T>(s){}
T& operator[](int i){return at(i); }
const T& operator[](int i)const{ return at(i);}
};
...
The error:
test.cpp(5) : error C2143: syntax error : missing ',' before '<'
test.cpp(12) : see reference to class template instantiation 'Vec<T>' being compiled
How do I fix this?
---Edit---
Some context:
I am trying to compile code essentially copy and pasted from The C++ Programming Language. I don't yet even understand this code completely. The purpose, however, is to implement a vector type that will throw an exception when some code attempts to access an item out of the vector's range instead of just returning incorrect values.