470,571 Members | 2,420 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,571 developers. It's quick & easy.

multidimensional arrays

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?

Sep 10 '06 #1
5 1812
asdf wrote:
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?
E.g.,

std::vector< std::vector< int
Best

Kai-Uwe Bux
Sep 11 '06 #2

asdf 写道:
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?
There are boost library
http://www.boost.org/libs/multi_arra...c_introduction

see if it fits your needs.

Sep 11 '06 #3
"asdf" <li*********@gmail.comwrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
>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?
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<intIntVector;
};

std::vector<MyListMy2DArray;

I just find the syntax a bit easier than
std::vector<std::vector<int My2DArray;
Sep 11 '06 #4

Jim Langston 写道:
"asdf" <li*********@gmail.comwrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
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?

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<intIntVector;
};
Why use a struct here, why not just do
typedef std::vector<intMyList;
std::vector<MyListMy2DArray;

I just find the syntax a bit easier than
std::vector<std::vector<int My2DArray;
Sep 11 '06 #5
asdf posted:
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?

Long live inefficient code!

--

Frederick Gotham
Sep 11 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Terry | last post: by
9 posts views Thread by Charles Banas | last post: by
3 posts views Thread by Ravi Singh (UCSD) | last post: by
21 posts views Thread by utab | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.