Smart Pointers as Objects

Learn the relationship between const and smart pointers as objects.

What is a smart pointer?

An instance of a smart pointer is an object consisting of a raw pointer and some data for lifetime management. The exact internal representation is not important in our case.

In other words, having a smart pointer means that we have a wrapper object around a pointer, and the general principle for class type parameters kicks in. What’s that general principle?

We should pass around class type parameters by reference, preferably by const reference.

We found that passing smart pointers by ...