Assume we have a type A
with a member that understands move semantics and we wish to implement move semantics for A
as well;
struct A {
::std::vector<int> ints;
A(A&&);
};
When implementing A::A(A&&)
do we have to explicitly ::std::move
the ints
member or will it be passed as ::std::vector<int>&&
automatically? That is, will these do the same:
A(A&& a) : ints(a.ints) {} // version 1
A(A&& a) : ints(::std::move(a.ints)) {} // version 2