problem about iterator in class

Dear all,

Now I have to treat data in vector format. What I want to do now is to either insert ot erase an element to or from vector respectively. However, according to my current program that tookover from other people, when I want to create iterator, there are always error that
34 D:\research project CD\CAT\Simulation\PROGRAM\data.cpp `iterator' does not name a type
368 D:\research project CD\CAT\Simulation\PROGRAM\contentbalancing.cpp no matching function for call to `std::vector<double, std::allocator<double> >::erase(int)'

The code is here

(data.cpp)
#ifndef _DATA_CPP
#define _DATA_CPP

#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <iterator>
using namespace std;

//2D vector for any data type
template <typename Type>
class TwoDVector{
vector<vector<Type> > arr;
public:
TwoDVector(){}
TwoDVector(int i){arr = vector<vector<Type> >(i);}
TwoDVector(int i, int j){arr = vector<vector<Type> >(i, vector<Type>(j));}
TwoDVector(int i, int j, int initVal){
arr = vector<vector<Type> >(i, vector<Type>(j, initVal));
}
void push_back(vector<Type>& v){arr.push_back(v);}
int size(){return arr.size();}
int numCol(){return arr[0].size();}
vector<Type>& operator[](int i){return arr[i];}
void pop_back(){arr.pop_back();}
void resize(int i){arr.resize(i);}
void clear(){arr.clear();}
iterator erase(iterator loc){arr.erase(&loc);}

};

So, how can I define the erase function in this case?

thanks and best regards,
Michael
replace iterator with vector< vector<T> >::iterator
You may need typename vector< vector<T> >::iterator.
But why are you using the ampersand? arr.erase(&loc);
Topic archived. No new replies allowed.