A nice "in a nutshell" about why you should run, not walk, to take advantage of move semantics:
Time To Get Moving!
by Tony DaSilva
From the article:
Starting from C++11 on, we not only get those operations for free for our user-defined types, we also get these turbo-boosters:
- a “free” move constructor
- a “free” move assignment operator
In addition, all of the C++ standard library containers have been “move enabled“.
When I first learned how move semantics worked and why this new core language feature dramatically improved program performance over copying, I started wondering about user-defined types that wrapped move-enabled, standard library types. For example, check out this simple user-definedMsg
structure that encapsulates a move-enabledstd::vector
...
Add a Comment
Comments are closed.