Is there / should there be a way to track the validity of a raw pointer taken from a smart pointer for debug/QA purposes?
问题 As I understand C++ Core Guidelines by Bjarne Stroustrup & Herb Sutter, it is a good idea to use pointers this way: unique_ptr for the good old clear one ownership shared_ptr for truly shared ownership by design weak_ptr when by design the pointer might not be valid anymore raw pointer whenever the pointer is valid by design, and ownership is unchanged Thus theoretically it still may be a common bug that a raw pointer becomes invalid (see R37). I wonder if there is a way for debug/QA purposes