jeudi 1 décembre 2016

Why does shared_ptr have a move constructor

In C++11 std::shared_ptr has a move constructor and move assignment operator.

Is there and reason why this is needed, i.e. would any programs using it behave differently if there were only the copy constructor and assignment operators?

It seems that the only effect of it is that the extra increment and later decrement of the reference counter is avoided.

Aucun commentaire:

Enregistrer un commentaire