C++ holds its grip on large swaths of the software industry by virtue of its performance--well-written C++ code runs faster than anything else out there, almost by definition, because C++ gives the programmer almost complete control over the code that is ultimately generated by the compiler.
One of the classic features of low-level, performant code is the use of raw pointers (Foo*). However, raw pointers come with many pitfalls, such as memory leaks and dangling pointers. The C++11 library's "smart pointer" types can help you avoid these pitfalls at little to no expense.
In this chapter we'll learn the following:
- The definition of "smart pointer" and how you might write your own
- The usefulness of std::unique_ptr<T> in preventing ...