And how realistic is the use of such a thing here:
typedef boost::multi_index_container<foo, ... struct foo { ... std::unique_ptr<Bar> bar; // requires move-semantic only foo() { bar = std::make_unique<Bar>(); } foo(foo&&) = default; }; push_back compiles successfully - just push_back (std :: move (...)).
The search is also compiled if I do not iterate, but immediately pass the iterator obtained from find to the function:
auto it = container.get<...>().find(...); container.erase(it); But I still need to go through all the elements of the container. I do this:
for (auto it = container.begin(); auto it = container.end(); ++it) { some_foo(*it); // Например, another_container.push_back(*it) - чтобы добавить элемент в другой контейнер } And it does not compile. None of the options:
some_foo(std::move(*it)) some_foo(std::move(it)) some_foo(it) some_foo(*it) It wants a copy constructor instead of a constructor move ...