array holding 2D arrays

M

malla

hi
i am trying to store a bunch of 2D array objects (I have a class called
DoubleArray2D) in a simple 1D array. Can someone point me towards how I
should begin doing this.

Thanks a lot.
 
K

Kai-Uwe Bux

malla said:
hi
i am trying to store a bunch of 2D array objects (I have a class called
DoubleArray2D) in a simple 1D array. Can someone point me towards how I
should begin doing this.

What about std::vector< DoubleArray2D >?


Best

Kai-Uwe Bux
 
V

Victor Bazarov

malla said:
i am trying to store a bunch of 2D array objects (I have a class
called DoubleArray2D) in a simple 1D array. Can someone point me
towards how I should begin doing this.

What does 'DoubleArray2D' look like? Do you know how to declare
a simple single-dimensional array of, say, 'int'? What's stopping
you from replacing 'int' with your 'DoubleArray2D'?

V
 
M

malla

Victor said:
What does 'DoubleArray2D' look like? Do you know how to declare
a simple single-dimensional array of, say, 'int'? What's stopping
you from replacing 'int' with your 'DoubleArray2D'?

V

Thanks for replying.

I am going to use vector for this. But thanks for pointing out arrays.
I dont really know how to create a multiple array in C++. also can I
create an array that will hold anything in any variation?
 
V

Victor Bazarov

malla said:
[..]
I dont really know how to create a multiple array in C++.

What book on C++ are you reading that doesn't cover arrays?
also can I
create an array that will hold anything in any variation?

I don't understand the question. "Anything"? Do you mean,
like a list in Python? No, you cannot. An array in C++ has
its type, and all elements of that array are of the same type.

V
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top