1. 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:

      1. to allow traversal of "all handles in deque three times to collect garbage" (comment above 'void recycler::recycle() throw()' in cyclic_ptr.cpp).
      2. 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.

 
It is just a coding error if you initialized two different smart pointers with the same raw pointer:  std::auto_ptr and boost::shared_ptr have the same restriction.  So I wouldn't recommend paying the performance price of maintaining a no_duplicates set in production code.