Click to See Complete Forum and Search --> : CArray


Mustafa
October 16th, 1999, 08:04 PM
Hi All
Is it possible to create a 2D-Array with CArray if so how??.

Thanks in advance
Mustafa

Weiye
October 16th, 1999, 11:19 PM
I think this may look a bit uncommon, but....

(Assume 2D array of integers with 2 rows)

CArray <int, int> oa2DArray[2];

Hope this helps

From Weiye

Paul McKenzie
October 17th, 1999, 04:20 PM
Try the following:

#include <afxtempl.h>
typedef CArray<int, int&> Inner;
typedef CArray< Inner, Inner& > Int2DArray;
// OR the following could have been used
// typedef CArray< CArray<int, int&>, CArray<int, int&>& > Int2DArray;

Int2DArray myArray;
...



All I did was create a CArray of CArrays. I used typedefs to simplify things.

Regards,

Paul McKenzie