Boost logo

Boost :

Subject: Re: [boost] [Container] small flat set ?
From: Phil Endecott (spam_from_boost_dev_at_[hidden])
Date: 2017-09-06 15:18:53


Hi degski,

degski <degski_at_[hidden]> wrote:
> On 4 September 2017 at 18:12, Phil Endecott via Boost <boost_at_[hidden]
>> wrote:
>>
>> But that gets complicated if you need iterators with the normal behaviour.
>>
>
> Wrap a std::vector or a std::array (if fixed size) and forward the begin()
> and end() iterators of the container. This then will also give you range
> based for loops (for free) on your type.

Of course that works for a sorted vector.

But in the part of my message that you didn't quote, I mentioned
storing the values in an unsorted vector and doing linear search.
In this case, you can usefully iterate over the entire container
as long as you don't care about the order, but you can't iterate
over, for example, the range between two elements that you get
from find().

Regards, Phil.


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