Hello there,
I have defined a generic class for two-dimensional arrays, called Grid<G>.
I would like to define the operator[] with two arguments, ie the row and the column that define the coordinates of the item to access :
With VC++ 6.0 the compiler complains :
error C2804: binary 'operator [' has too many parameters
How would you work around this?
Or maybe another syntactic sugar.
Thanks.
--
Globos
I have defined a generic class for two-dimensional arrays, called Grid<G>.
I would like to define the operator[] with two arguments, ie the row and the column that define the coordinates of the item to access :
Code:
template<class G>
class Grid : public Array<G>
{
// All other features skipped...
public:
virtual const G& operator[] (int row, int column) const
{ // Body here.
}
};
With VC++ 6.0 the compiler complains :
error C2804: binary 'operator [' has too many parameters
How would you work around this?
Or maybe another syntactic sugar.
Thanks.
--
Globos