Boost logo

Boost :

Subject: Re: [boost] [flat_set] When to sort?
From: Chris Glover (c.d.glover_at_[hidden])
Date: 2017-03-28 20:04:29

> std::vector<int> buf=s.get_data(); // move, s becomes empty
> for(...)buf.push_back(...); // populate
> s.accept_data(buf); // move and sort
I like this idea -- but I don't think accept_data can do the sort because
sort might not be enough; the contents might need to be made unique too. We
could add the call to unique inside accept_data, but that pessimises the
case where I know my data is unique. So I think it would need to be more

std::vector<int> buf=move(s).get_data();
for(...) buf.push_back(...); // populate
unique(buf); // If my contents might not be unique.
s.adopt_ordered_unique_data(move(buf)); // Asserts data is in fact ordered
and unique?

-- chris

Boost list run by bdawes at, gregod at, cpdaniel at, john at