In this recipe, we will learn how to work with circular references. A circular reference occurs when we're using more than one std::shared_ptr, where each std::shared_ptr owns a reference to the other. This recipe is important as this type of circular reference can occur when we're working with circularly dependent objects (although this should be avoided whenever possible). If it does occur, the shared nature of std::shared_ptr results in a memory leak. This recipe will provide you with the skills to avoid said memory leak using std::weak_ptr.
Working with circular references
Getting ready
Before beginning, please ensure that all of the technical requirements have been met, including installing Ubuntu 18.04 or...