|
Boost : |
Subject: Re: [boost] [utility] new auto_buffer class --- RFC
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2009-03-05 18:29:41
Nevin ":-]" Liber skrev:
> 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
Already there.
> 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.
There is a newer version if you look in the thread
[utility] auto_buffer v2
I do not want to supply the whole interface of vector. For the
operations that they have in common, it is almost a drop-in replacement.
I say almost, because this class is really about speed, and often don't
allow overlapping ranges, assignment to *this etc. The exception-safety
guarantees might also be weaker if it hurts performance.
-Thorsten
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk