Good evening, I am trying to make a templated class which will have two members that are const_iterators point to the beginning and end of a subsection of a vector. I wanted to make the class generic so that I can use it for a vector of any type.
My class definitions is in file ThreadWorker.h and looks as follows:
template <typename T>
class VectorWorker
{
public:
VectorWorker<T>() = default;
VectorWorker<T>( std::vector<typename T>::const_iterator begin, std::vector<typename T>::const_iterator end);
void Work() const;
private:
std::vector<typename T>::const_iterator beginIt; /* Stores value of left iterator that defines data for this worker */
std::vector<typename T>::const_iterator endIt; /* Stores value of right iterator that defines data for this worker */
};
When i attempt to compile my code I get an error stating that the template arguments are invalid:
error: template argument 1 is invalid
VectorWorker<T>( std::vector<typename T>::const_iterator begin, std::vector<typename T>::const_iterator end);
I don't quite understand why I am getting this error, since I have specified via the "typename" keyword that T is a typename template parameter. Could anyone help explain what is going on here, or point me to a good resource? Thanks.