- Smart Pointer CTOR
This calls handles.deque
::push_back and, #ifndef NDEBUG, no_duplicates.set ::insert. The void* in set is actually a T* where T is the T in recyclable_base , the base class for cyclic_ptr and weak_ptr. The purpose of the static std::deque
handles (in cyclic_ptr.cpp) is:
- to allow traversal of "all handles in deque three times to collect garbage" (comment above 'void recycler::recycle() throw()' in cyclic_ptr.cpp).
- to allow the user to specify a finalizer (or, in cyclic_ptr's case, a "deleter") for each instance of the pointee.
However, the no_duplicates actually must be used for production code and as well as for debugging; otherwise, if the same pointer is contained in 2 different cyclic_ptr's, then it will be deleted twice.