One approach is using std::pair
:
class Array2D
{
int** m_p2dArray;
public:
int operator[](const std::pair& Index)
{
return m_p2dArray[Index.first][Index.second];
}
};
int main()
{
Array2D theArray;
pair theIndex(2,3);
int nValue;
nValue = theArray[theIndex];
}
Of course, you may typedef
the pair