|
Boost : |
Subject: Re: [boost] [container] moving a pre-built vector into a flat_set
From: Chris Glover (c.d.glover_at_[hidden])
Date: 2015-09-15 20:24:28
<snip>
>
> what i would like to be able to do is move the vector straight into the
> flat_set, something like:
>
> std::vector<T> data;
>
> flat_set data_set1(std::move(data)) // move vector in and sort it
> // or:
> std::sort(data.begin(), data.end()); // sort vector
> flat_set data_set2(ordered_unique_t, std::move(data)) // and move it in
>
> is this doable (am i just being blind?) or is there plans/interest for
> this?
>
</snip>
You'll probably never be able to move the whole allocation, but you might
be able to move each element via std::make_move_iterator
flat_set data_set2(ordered_unique_t, std::make_move_iterator(data.begin()),
std::make_move_iterator(data.end())); // moves each element, but not the
whole allocation, so still not free.
I haven't tried this though.
-- chris
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk