CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2012
    Posts
    8

    Is 2D cliext::vector myth ??

    Hi ,
    This is my first post to CodeGuru. I have been seeking for a 2D cliext::vector decleration for a long long time, i found nothing ! I saw that some other people are looking for the same subject. However i am not sure that even they exist or not?
    Any help will be greatly appreciated.


    PS. I have some cliext::vector syntax which are working fine. Finally i need a 2d vector , if it really exists.

    #include <cliext/vector>
    using namespace cliext

    vector<int^>^vec = gcnew vector<int^>(9) ;

    vect->push_back(7) ;
    vect->pop_back(7);
    vec->erase(vec->begin()+3) ; // delete 3rd vector members
    vec->eraser(vec->begin(),vec->begin()+3) ; // delete first 3 member


    vec->size(); // new size

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

    Re: Is 2D cliext::vector myth ??

    Quote Originally Posted by ey_dsl View Post
    Hi ,
    This is my first post to CodeGuru.
    You posted your question in the wrong forum.

    Your code is Managed C++, not ANSI C++ using the Visual C++ compiler.
    Code:
    vector<int^>^vec = gcnew vector<int^>(9) ;
    That code is gibberish here, but it makes sense in the Managed C++ forum.

    Regards,

    Paul McKenzie

  3. #3
    Join Date
    Feb 2012
    Posts
    8

    Re: Is 2D cliext::vector myth ??

    Is there a managed c++ forum ?

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

    Re: Is 2D cliext::vector myth ??

    Quote Originally Posted by ey_dsl View Post
    Is there a managed c++ forum ?
    http://www.codeguru.com/forum/forumdisplay.php?f=17

    Regards,

    Paul McKenzie

  5. #5
    Join Date
    Feb 2012
    Posts
    8

    Re: Is 2D cliext::vector myth ??

    Thanks.

  6. #6
    Join Date
    Oct 2011
    Posts
    23

    Re: Is 2D cliext::vector myth ??

    There is always a work-around. You can try this as well . . .

    Code:
    #include <vector>
    
    using namespace std;
    
    typedef vector<int> vec; // or whatever the type you like
    typedef vector<vec> vec_vec
    typedef vec::iterator _vec;
    typedef vec_vec::iterator _vec_vec;
    A vector of vectors will give you the same results. Each vector can then contain two or more of whatever - the big iterator is for walking the vector of vectors, and the little iterator is for walking the individual vectors as you access them.

    Perfect Health and Clarity of Mind,

    --Victor

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