Possible Duplicate:
C++ Overloading : Overloading the [][] operator
I have a class matrix, its data is stored in vector<vector<double> > _data
and I want to overload the [][]
operator to return _data[row][cols]
I was looking around but couldn't quite understand how to do that using vector
of vector
I know I need to overload the []
operator, but it only receives one parameter.
Was thinking of maybe creating an inner helper class but I can't quite get my head around this one.
Any ideas?
Thanks