C++ quick tips: shared_ptr aliasing constructor
C++20 provides a small addition to shared_ptr
constructor overloads set which is called an
aliasing
constructor.
Quoting after cppreference:
The aliasing constructor: constructs a shared_ptr which shares ownership information with the initial value of r, but holds an unrelated and unmanaged pointer ptr. If this shared_ptr is the last of the group to go out of scope, it will call the stored deleter for the object originally managed by r…