vendredi 21 octobre 2016

Move unique_ptr from set to set

I can't seem to figure this out and have tried the suggestions in:

Move `unique_ptr`s between sets

how to move an std::unique_ptr<> from one STL container to another?

I have two sets containing unique pointers:

std::set<std::unique_ptr<some_type>> s1, s2;

The pointers are of course unique but the values of some_type may or may not be, so after joining the s2 into s1, s1's size may be the same or as large as |s1 + s2|.

It seems like I should be able to do this:

move(s2.begin(), s2.end(), inserter(s1, s1.end()));

But this fails with clang++ 3.8 / g++ 5.4.

What am missing here?

Aucun commentaire:

Enregistrer un commentaire