svector icon indicating copy to clipboard operation
svector copied to clipboard

v.push_back(v[0]) doesn't work, can lead to segmentation fault on resizing

Open martinus opened this issue 2 years ago • 0 comments

Describe the bug or v.assign(1000, v[0]). This should work, it does so per the standard for std::vector, even when it needs to resize.

See https://stackoverflow.com/a/18788810/48181

martinus avatar Apr 19 '23 11:04 martinus