O'Reilly logo

C++ Standard Library Quick Reference by Marc Gregoire, Peter Van Weert

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

© Peter Van Weert and Marc Gregoire 2016
Peter Van Weert and Marc GregoireC++ Standard Library Quick Reference10.1007/978-1-4842-1876-1_2

2. General Utilities

Peter Van Weert and Marc Gregoire2
(1)
Kessel-Lo, Belgium
(2)
Meldert, Belgium
 

Moving, Forwarding, Swapping<utility>

This section explains move(), move_if_noexcept(), forward(), swap(), and exchange(). In passing, it also introduces the concepts of move semantics and perfect forwarding.

Moving

An object can be moved elsewhere (rather than copied) if its previous user no longer needs it. Moving the resources from one object to another can often be implemented far more efficiently than (deep) copying them. For a string object, for instance, moving is typically as simple as copying a char* pointer ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required