...to function? Hi everyone:
I would be very grateful for some advice on a problem I'm having with 2-D array subscripting.
The problem is that some of my arrays are subscripted as array(i, j) (these were created in a class) and some are dynamic arrays subscripted as array[j]. I cannot pass both kinds of arrays as arguments to my functions.
Is there a fix for this? In the array class that produces array(i,j), I tried overloading my subscripting definition, but this did not work. In other words, I currently have:
T& operator ( ) ( int x, int y );
const T& operator( ) ( int x, int y ) const;
And I tried overloading by adding a second definition for []. This produced so many errors that I won't even try to write them all down here.
Does anyone know of a way to pass arrays as arguments to functions, where some of the arrays are subcripted as array[j] and some are array(i,j)?
Thank you very much for any help.
I would be very grateful for some advice on a problem I'm having with 2-D array subscripting.
The problem is that some of my arrays are subscripted as array(i, j) (these were created in a class) and some are dynamic arrays subscripted as array[j]. I cannot pass both kinds of arrays as arguments to my functions.
Is there a fix for this? In the array class that produces array(i,j), I tried overloading my subscripting definition, but this did not work. In other words, I currently have:
T& operator ( ) ( int x, int y );
const T& operator( ) ( int x, int y ) const;
And I tried overloading by adding a second definition for []. This produced so many errors that I won't even try to write them all down here.
Does anyone know of a way to pass arrays as arguments to functions, where some of the arrays are subcripted as array[j] and some are array(i,j)?
Thank you very much for any help.