FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
C++
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
February 01, 2004

Smart Pointers Reloaded (III): Construction

(Page 3 of 3)
February 04: Smart Pointers Reloaded (III): Construction Trackingsmart_ptr initialization

Listing 2: The resource_manager class in action.

template <class storage_policy, class ownership_policy>
class resource_manager
   : public optimally_inherit<storage_policy, ownership_policy>::type
{
   ...
   ~resource_manager() {
      if (!ownership_policy::release(get_impl(*this))) {
         storage_policy::release();
      }
   }
};
template <
   typename T,
   template <typename> class ownership_policy = ref_counted,
   template <typename> class conversion_policy = disallow_conversion,
   template <typename> class checking_policy = assert_check,
   template <typename> class storage_policy = scalar_storage>

class smart_ptr : public optimally_inherit< resource_manager< storage_policy<T>, ownership_policy<T> >, optimally_inherit< checking_policy<T>, conversion_policy<T> > > { ... };

Previous Page | 1 | 2 | 3
TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK