I need create a string
/vector
. I know how long it should be, however, I'd like to write the right thing into it later. Can I create it with a specified length but without any initialization (neither explicit nor implicit), like what malloc does? Because I'll write into it properly before reading from it, it would be a waste of time to initialize it at construction.
I hoped I could write with arbitrary order after creating the vector, like
vector<int> v(10); // Some magic to create v with 10 of uninitialized ints
v[6] = 1;
v[3] = 2;
...
Seemingly that's impossible.