3 ms·
Of course, you need to call push_back() or insert() to add the data. Actually, insert() wouldn't even require reserve() in the first place. I guess the idea of
by spacechild1 3y ago
Of course, you need to call push_back() or insert() to add the data. Actually, insert() wouldn't even require reserve() in the first place.
I guess the idea of uninitialized resize is that you reserve the space, bump the size, and then you can directly set the new members with operator[]. If your input data is not contiguous, and would need to use push_back() otherwise, you can save a few if-checks. But that's pretty much it, I assume.