Programming Challenge 1
Description
Create a simple program to demonstrate the effectiveness/efficiency of move
semantics compared with copying. Use an example of a simple class that stores a
string. Provide construction by const-reference, by rvalue-reference, and by
value. Experimentally show the cost of these three different versions as the
size of the string grows.
Details
- Name the file and program
copy_vs_move.cpp
.
- Use C++11 clocks to time the construction process. Provide easily readable
program output.
- In your top file comment, please reflect on this exercise. Briefly state
what you learned and your main conclusions from your experimentation.