I have a template class that contains a vector of type pointers specified as a template parameter. I want to be able to use range-based iteration to iterate over a limited part of a vector. My class contains the following functions:
template< typename ObjectType >
class ObjectList
{
...
public:
std::vector<ObjectType*>::iterator begin();
std::vector<ObjectType*>::iterator end();
private:
std::vector<ObjectType*> object_ptrs;
};
This does not compile with the description Error C2061 syntax error: identifier 'iterator'. I can’t think of any reason why it std::vector<ObjectType>::iteratorwill never be found, unless ObjectTypeit can be found, but the rest of the class is successfully created if I delete the lines that refer to iterator.
Anyone have an idea what is going on? I am sure it is possible, I am missing something obvious. Thanks in advance!