lundi 16 novembre 2020

How to choose copy-and-swap or define copy / move assignment operator separately in C + +

I know that using copy and swap to define assignment operators ensures exception security and avoids self assignment. However, when a large number of move assignments are used, copy and swap will cause performance waste:Why is it not efficient to use a single assignment operator handling both copy and move assignment? When should I use copy and swap and define copy / move assignment operators separately?

Aucun commentaire:

Enregistrer un commentaire