Inherits AtCtr< Val >.
template<class Val, class LkT, template< class > class Del = jmmcg::default_delete, template< class > class AtCtr = LkT::template atomic_counter_type>
class jmmcg::sp_counter_type< Val, LkT, Del, AtCtr >
The intrusive counter that an object must also inherit from for the shared_ptr class to work.
A client must inherit from this class to allow the shared_ptr to operate. If the client also wants to specify at run-time which counter or deletion method is to be used, then some base in their hierarchy must also inherit from sp_counter_itf_type.
By default the counter is a "simple" (cough) sequential counter, with the threading model specified via the lock_traits.
- See also
- sp_counter_itf_type, shared_ptr
Definition at line 63 of file shared_ptr.hpp.
template<class Val, class LkT, template< class > class Del = jmmcg::default_delete, template< class > class AtCtr = LkT::template atomic_counter_type>
Make sure the correct object deletion mechanism is used.
Note this this allows the user to specify multiple features:
- That the correct deleter is used with the allocator.
- That if the static type of the object is known at compile-time the deleter can be used with little or no performance loss.
- That the deleter may be dynamically specified in a derived class, allowing the share_ptr to contain objects that also vary by the specific deleter that the derived type will use. For example there may be a collection of base-pointers, the derived objects of which may be dynamically, placement-new or stack-allocated and upon extracting them from the collection, the shared_ptr class can accommodate deleting all of them because of the flexibility introduced in sp_counter_itf_type::deleter().
- See also
- sp_counter_itf_type::deleter_t, sp_counter_itf_type::deleter()
Definition at line 78 of file shared_ptr.hpp.
template<class Val, class LkT, template< class > class Del = jmmcg::default_delete, template< class > class AtCtr = LkT::template atomic_counter_type>
This does not have to be the same as the atomic_ctr_t, as we may want the flexibility to deal with the type differently in this case.
Definition at line 68 of file shared_ptr.hpp.
template<class Val, class LkT, template< class > class Del = jmmcg::default_delete, template< class > class AtCtr = LkT::template atomic_counter_type>
Call the correct deleter_t object to delete the object.
Note that we are calling the dtor on the object from within a virtual function, which is allowed. (The converse is not, of course.)
Definition at line 93 of file shared_ptr.hpp.