vendredi 2 mars 2018

noexcept requirement of vector not upheld

Technically, noexcept specified move c'tor is requirement of vector to use move instead of copy c'tor.

I found that this is not the case with GCC 7.

vector<A> v;
v.push_back(A("555"));   //triggers move c'tor

The above works as long as A implements move c'tor and specifying the move c'tor as noexcept is not necessary.

I'd like to know if this is a GCC issue or is normal across compilers?
Or is it the case that I'm misunderstanding something?

Aucun commentaire:

Enregistrer un commentaire