3 ms·
Something that I need to remind myself often about why is that so: "In particular, the language forbids a “small vector optimization” analogous to the small str
by malkia 3y ago
Something that I need to remind myself often about why is that so: "In particular, the language forbids a “small vector optimization” analogous to the small string optimization (which we’ll see soon), because the standard requires that¹ moving a vector not invalidate iterators or references. The vector elements have to remain where they are. A small-vector optimization would put them in vector-internal storage, which would require that the element move from one vector to another on a vector move operation, which is not allowed."
Someone did a nice trick long time ago the other way around using std::basic_string with say... float or custom structure - for the benefit of "small vector optimization"