
2009/3/2 Scott McMurray <me22.ca+boost@gmail.com>:
LLVM has a similar class, FWIW: http://llvm.org/docs/ProgrammersManual.html#dss_smallvector
This is much closer to what I really want. If I were designing it, given template< typename T, size_t N = 0, typename A = allocator<T> > class ebo_vector<T, N, A> (where ebo stands for Embedded Buffer Optimization): 1. Interface is drop in replacement for std::vector<T>, T != bool 2. For ebo_vector<bool>, behave as if std::vector<bool> specialization did not exist 3. Runtime ability to set/reset the maximum capacity; defaults to std::vector<T, A>::capacity() 4. Ability to construct/resize with default (in addition to value) initialized elements Other comments: To keep the interface simple, N should be the number of embedded elements (I don't want to call them stack elements, as that is only true if the instantiation is on the stack) and should only be specified in terms of number of elements. If folks want to do it in terms of bytes, have some kind of traits class that can do the conversion. -- Nevin ":-)" Liber <mailto:nevin@eviloverlord.com> (847) 691-1404