Is std::array movable? Is std::array movable? arrays arrays

Is std::array movable?


std::array is movable only if its contained objects are movable.

std::array is quite different from the other containers because the container object contains the storage, not just pointers into the heap. Moving a std::vector only copies some pointers, and the contained objects are none the wiser.

Yes, std::array uses the default move constructor and assignment operator. As an aggregate class, it's not allowed to define any constructors.