Boost logo

Boost :

Subject: Re: [boost] [Container] small flat set ?
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2017-09-04 20:42:38


On 04/09/2017 17:12, Phil Endecott via Boost wrote:
> Dear all,
>
> boost::container::small_vector and boost::container::static_vector
> are great.  boost::container::flat_set is great too.
>
> But today I need a small_flat_set!  And I don't think it's
> possible to compose flat_set and small_vector.  (flat_set
> can use a custom allocator, but it can't take a custom
> implementation type in the way that, for example,
> std::priority_queue can.)
>
> Having said that, maybe composing flat_set and small_vector
> (or static_vector) isn't the optimum solution for the case
> where I will store something like 0...4 ints; I suspect that
> linear search in an unordered sequence will be quicker.  But
> that gets complicated if you need iterators with the normal
> behaviour.
>
> Any thoughts?

I recently committed to develop the initial implementation (not properly
tested!) to use a different container than boost::container::vector as
the underlying sequence. The idea is to pass a container instead of an
allocator:

flat_set<int, std::less<int>, small_vector<int> >

   and

flat_set<int, std::less<int>, static_vector<int> >

should work. Or better said, they'll work properly soon. Willing to try?

Best,

Ion


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