Move constructor and initialization list
c++, c++11, initialization, move-semantics, unordered-map
Solution
Say `member(std::move(other.member))`.
As a golden rule, whenever you take something by rvalue reference, you need to use it inside `std::move`, and whenever you take something by universal reference (i.e. deduced templated type with `&&`), you need to use it inside `std::forward`.
Problem
I want to implement move constructors (no copy constructor) for a certain type that needs to be a value type in a `boost::unordered_map`. Let's call this type `Composite`. `Composite` has the following signature: ``` struct Base { Base(..stuff, no default ctor) : initialization list {} Base(Base&& other) : initialization list {} } struct Composite { Base member; Composite(..stuff, no default ctor) : member(...) {} Composite(Composite&& other) : member(other.member) {} // <---- I want to make sure this invokes the move ctor of Base } ``` I want to write this so `boost::unordered_map< Key , Composite >` does not require the copy constructor, and just uses the move constructor. If possible, I don't want to use the copy constructor of `Base` in the initialization list of move constructor of `Composite`. Is this possible?