multidimensional arrays

Discussion in 'C++' started by asdf, Sep 11, 2006.

  1. asdf

    asdf Guest

    I was told not to use the low-level language such as arrays which
    inherited from C, I want to know what can I use to substitute the
    C-style multidimensional arrays? Is there multidimensional vector?
     
    asdf, Sep 11, 2006
    #1
    1. Advertisements

  2. asdf

    Kai-Uwe Bux Guest

    E.g.,

    std::vector< std::vector< int > >


    Best

    Kai-Uwe Bux
     
    Kai-Uwe Bux, Sep 11, 2006
    #2
    1. Advertisements

  3. asdf

    fightwater Guest

    asdf 写é“:
    There are boost library
    http://www.boost.org/libs/multi_array/doc/user.html#sec_introduction

    see if it fits your needs.
     
    fightwater, Sep 11, 2006
    #3
  4. asdf

    Jim Langston Guest

    The usually way is to do a vector of vectors, but I find that troublesome,
    and usually wind up encapsulating the 2nd vector. Something like:

    struct MyList
    {
    std::vector<int> IntVector;
    };

    std::vector<MyList> My2DArray;

    I just find the syntax a bit easier than
    std::vector<std::vector<int> > My2DArray;
     
    Jim Langston, Sep 11, 2006
    #4
  5. asdf

    fightwater Guest

    Jim Langston 写é“:
    Why use a struct here, why not just do
     
    fightwater, Sep 11, 2006
    #5
  6. asdf posted:

    Long live inefficient code!
     
    Frederick Gotham, Sep 11, 2006
    #6
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.