Hi,
I have implemented a template class which encaptulates a 2d dynamic array. Basically the class looks like this:
template <class T>
class Dynamic2dArray {
private:
std::vector<std ::vector<T> > data;
public:
Dynamic2dArray( );
Dynamic2dArray( int rows);
Dynamic2dArray( int row, int col);
............... ...............
............... ............... ..
std::vector<std ::vector<T> >::const_iterat or begin() const;
};
template <class T>
std::vector<std ::vector<T> >::const_iterat or Dynamic2dArray< T>::begin() const{
return data.begin();
}
I have implemented everything except this last method: begin() which is supposed to return the iterator pointing the first element in the vector in the same manner as used in std::vector.
I am getting the following compilation error pointing to the declaration of this end method: error: expected `;' before "begin".
I also noticed that when I try to declare a variable itRow (shown below) in another instance the same error is raised.
std::vector<std ::vector<T> >::const_iterat or itRow;
Does any one know how to solve this problem? I would really appreciate your prompt response.
Thanks and Regards,
Mohan.
I have implemented a template class which encaptulates a 2d dynamic array. Basically the class looks like this:
template <class T>
class Dynamic2dArray {
private:
std::vector<std ::vector<T> > data;
public:
Dynamic2dArray( );
Dynamic2dArray( int rows);
Dynamic2dArray( int row, int col);
............... ...............
............... ............... ..
std::vector<std ::vector<T> >::const_iterat or begin() const;
};
template <class T>
std::vector<std ::vector<T> >::const_iterat or Dynamic2dArray< T>::begin() const{
return data.begin();
}
I have implemented everything except this last method: begin() which is supposed to return the iterator pointing the first element in the vector in the same manner as used in std::vector.
I am getting the following compilation error pointing to the declaration of this end method: error: expected `;' before "begin".
I also noticed that when I try to declare a variable itRow (shown below) in another instance the same error is raised.
std::vector<std ::vector<T> >::const_iterat or itRow;
Does any one know how to solve this problem? I would really appreciate your prompt response.
Thanks and Regards,
Mohan.
Comment