Troy shows his solution to the challenge of moving a big object efficiently.
- [Instructor] So how'd it go?…Were you able to complete this challenge?…The clues for this challenge were…that you should use DemoRaii as your model,…and kind of keep in mind that a real resource…still has a lot more work to do.…Let's take a look at my solution.…So as I said, we have here, here's the original DemoRaii,…and here is the one that I built for the challenge.…So this is DemoRaii2.…
It takes in an integer resource ID,…it saves that ID out with the constructor…and the destructor.…It renders out the resource ID.…Then I made a couple of additions to the Demo function.…It now has two of these Demo twos mixed in,…one before and one after the originals,…and everything else should still be the same…so let me go ahead and set this to True,…and we'll save it.…
I will open it up in the command line,…and do a clang++ -std=c++17 -Wall main.cpp…And then do a ./a.out to execute it,…and now we can see…that we are entering the demo.…We get our first one, and notice it has an ID number,…then we get alpha and beta, the originals,…
- Major new C++ features
- Turning on modern C++
- Letting the compiler help
- Using the new features correctly
- Using auto type deduction
- Using lambdas
- Range-based for loops
- How C++ and the Standard Template Library name things
- Making the best of the filesystem library
- Managing objects
Skill Level Beginner
1. What Is Modern C++?
2. Tools That Improve Your Code
3. Using the New Features Correctly
4. Don't Reinvent the Wheel
5. Managing Objects
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.