mercredi 31 août 2016

Placement new plus destructor and simple value initialization semantic

Can one assume in unevaluated context, that (::new (std::declval< void * >()) T())->~T() is semantically full equivalent to simple T()? Assume neither global, nor class-scope operator new are not overloaded, if it mutters much.

Often in type traits T() used inside operator noexcept() to determine whether only the separate constructor is noexcept or not. Surely it is wrong.

To prevent the loss of generality one can assume that T() here is either a calling of a default constructor or of any other constructor.

Aucun commentaire:

Enregistrer un commentaire