Quick Q: Is std::array movable any better than a plan C array? -- StackOverflow

Quick A: Yes.

Today on SO:

Move constructors and std::array

According to N3485 §23.3.2.2:

(...) the implicit move constructor and move assignment operator for array require that T be MoveConstructible or MoveAssignable, respectively.

So, std::array supports move semantics if the type of its elements does. Great!

However, what does this really mean? I tend to picture this type as a safer version of an array providing an STL-compliant interface but, if this is true, then how can an std::array move-construct its elements? Can I do the same with an ordinary array?

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.