Re: Hellp in handling 2^15 variables
Hakusa@gmail.com ha scritto:
On Jul 20, 8:28 am, Sai Krishna <sai333...@gmail.com> wrote:
My project involves lots of variables. I need to handle 2^15 double or
float variables for the time being. g++ failed to handle as static
memory.
Failed to handle static memory? What's the line of code you used to
create this array?
This one, for example, does not fail to compile:
static float* floatArray = new float[32768];
I'm not surprised a vector was of no use; vectors are used for solving
a completely different set of problems.
Well I am surprised to hear that a vector is expected to have a
behaviour different from the line you wrote above, because the only
significant difference between that and
std::vector<float> floatVector(32768);
is that the content of vector is zero-initialized.
Anyway, you are correct that std::vector is intended to solve a
different set of problems. The correct container in the case of the OP
is probably std::valarray.
HTH,
Ganesh
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]