Boost logo

Boost :

Subject: Re: [boost] [interprocess][circular_buffer] specialized containers should have container template argument
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2009-05-04 12:22:45


Thorsten Ottosen wrote:
> However, we can make them faster if you allow a new template argument.
> For example
> template
> <
> typename T,
> typename Pred,
> typename Alloc
> class PushBackContainer = /* some default */
> >
> class flat_set;
>
> My motivation is that these can perform somewhat better e.g. with an
> array (for circular_buffer), or auto_buffer (for flat_set/flat_map).
> I think even some very simply array wrapper would be useable with
> flat_set.

Interesting, but it seems that PushBackContainer and Allocator overlap.
auto_buffer is basically an allocator. But flat_xxx could be implemented
in any sequence container with random-access iterators (we need them for
binary search), so maybe it could be interesting to have more generic
classes like map_sequence<>, set_sequence (names are horrible I know,
but it's just an example):

template<class Sequence>
class set_sequence;

set_sequence<vector<T>>
set_sequence<deque<T>>

or something more similar to std::queue:

template<class T, class Sequence>
class set_sequence;

Anyway, my opinion is that we should only use a minimal interface for
Sequence ((r/c)begin,(r/c)end, insert, erase, clear()).

Another option would be something like:

template< class T
         , class Allocator
         , class Sequence = vector<T, A>
>
flat_set;

and we should require (as we require for allocator::value_type) that
Sequence::value_type is T and Sequence::allocator_type is Allocator.

> The EA STL implementation has this features.

I will look at this. Is there any public

>
> What do you think?

These days I don't have much time and I have other improvements with
higher priority but I will add to the to-do list.

Thanks,

Ion


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk