C++ has more than one kind of pointer now, Troy shares his thoughts on how to choose the correct pointer for your code.
- [Instructor] Which pointer, when?…Shared pointers have reference counters…associated with them.…Each time it is copied, its reference count goes up…and the count goes down when the pointer…goes out of scope.…When the count reaches zero, it is deleted automatically.…The overhead is higher than other pointer types,…but worth it if you need…this kind of automatic lifetime management.…Unique pointers allow for unique ownership of a resource.…If you have it, you own it and you need to take care of it.…Copying is not allowed, by definition,…but it does have support for move semantics,…so you can easily transfer ownership.…
Weak pointers are one of those things…that you rarely need, but when you do, you'll know.…I've used them in graphics programming…to stop the circular reference between parent…and child objects prevent either from being freed.…In general, unique pointers should be your default.…
- 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.