CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: CArray

  1. #1
    Join Date
    Sep 1999
    Location
    malaysia
    Posts
    191

    CArray

    Hi All
    Is it possible to create a 2D-Array with CArray if so how??.

    Thanks in advance
    Mustafa

    ______________________________
    To err is human, it's the computer that causes blunders !!!

    DO: Dazzle me with your intelligence
    DON'T : Confuse me with your bullshit

  2. #2
    Join Date
    Jun 1999
    Location
    Singapore
    Posts
    1,304

    Re: CArray

    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

    Chen Weiye
    -----------------------------------------------------------------------------
    When pursuing your dream, don't forget to enjoy your life
    -----------------------------------------------------------------------------

  3. #3
    Join Date
    Apr 1999
    Posts
    27,449

    Re: CArray

    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured