I would like to have a couple of arrays of doubles with variable sizes, it could be 20, it could be 500 000.
I need access to each item individually with an index.
The size may vary during the execution of the program.
I've no idea how to do this, and I'd like to have some ideas.
Thanks for reading and hopefully you can help me out,
Rob Bresseleers
aka dirtcrusher
vector<double> V ( 20 ); // creates a vector of 20 doubles
V.resize ( 500000 ); // changes the size to 500000, BTW why so many elements?
V[0] = 5; // access elements as with arrays
vector<double> aNiceShinyVector (x);
aNiceShinyVector[3] = 0.4; // example setting value in the third element of your vector
where x is some value you'd like to set the size to at the start, for convenience, but this can be determined at runtime and you can change the size when you like.