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.
General Instructions, Turning in assignments, and Grading
General Instructions
- Name each file and program as listed in the instructions.
- The top of each program should have a comment block where the first line
is your name and following lines are a description of your program and
references used in programming.
//Name: Jory Denny
//This program debates Batman vs Superman!
//References:
// - Ref 1. - Follow turn-in instructions precisely.
- Failure to complete any of these steps will result in an incomplete.
Turn in Instructions
Each assignment will be turned in through GitHub classroom. Please find the link to create a repository at the top of this page, or through this link. Assignments are due BEFORE, let me repeat, before class starts. This does not mean five minutes after class starts.
- Soft copy (Online submission)
- Accept the invitation to the classroom assignment, which creates your repository on GitHub.
- Clone this repository, which includes some starting files.
- Add assignment files (stage, commit, push).
- Modify the Coverpage.txt file to provide name, sources, signature of following the honor code, etc. Be sure to stage, commit, and push these changes as well. If you do not fill out the coverpage, I will not grade the assignment.
- After the due date, I will clone your repository and add a grade and comments as necessary. After which you can pull these changes for your records.
Points
- Each assignment is a completion grade. In order to receive a completion, the code must compile and all parts of the challenge need to be completed.
- Note - a compiling, correct program ≠ 100%, just like a composed paper with the minimum requirements discussed ≠ 100% for an English Writing class.
- If there are any discrepancies in grades please see the instructor during his office hours or by appointment (do not discuss with the lab assistants or graders).