Smart pointers are pointers that free their allocated memory automatically when they go out of scope. In this way, memory leaks are avoided automatically. Use make_shared and make_unique to create smart pointers.