Starting with this snippet:
#include <string>
#include <tuple>
class wrap {
public:
std::array<std::string, 3> a;
wrap(std::array<std::string, 3>&& input) : a(std::move(input)){};
};
I read on several sources that an std::array
has no move constructor which would make no sense, yet syntax above implies that its not the std::array
that is moved but its element.
I couldn't found a word about that in cppreference (for instance) and finally stumbled on this post.
It basically says that:
In exactly the same way as any other aggregate. Its implicit move-constructor will move-construct all its members, including the elements of any member arrays.
What would be the standard reference? The best I found is n2904 Defining default copy and move and Move constructors and std::array
, regarding std::array
only.