
23 Jan
2011
23 Jan
'11
4:11 a.m.
[Emil Dotchevski]
std::vector is allowed to be stack-based when possible.
STL containers must support O(1), nofail, non-iterator-invalidating swaps*. According to my understanding, this forbids a "Small Vector Optimization", if not in theory then in practice (i.e. without compromising performance elsewhere). STL (* With a few exceptions, like for std::string's Small String Optimization, and for end iterators to permit container-internal sentinel nodes.)