|
Boost : |
Subject: Re: [boost] [utility] new auto_buffer class --- RFC
From: Nevin \ (nevin_at_[hidden])
Date: 2009-03-05 18:09:00
2009/3/2 Scott McMurray <me22.ca+boost_at_[hidden]>:
> 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_at_[hidden]> (847) 691-1404
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk