vendredi 8 mai 2015

Why does std::vector require move-constructors for its elements?

C++98 stated that std::vector elements should have copy-constructors. In C++11 that's no longer the case. Instead, the elements must have move-constructors.

Depending on what you do with std::vector, you may or may not really need to call the copy- or move-constructor, yet only one of them is always formally required by the standard. Why?

Aucun commentaire:

Enregistrer un commentaire