Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r55082 - in sandbox/fmhess/boost: generic_ptr smart_ptr
From: fmhess_at_[hidden]
Date: 2009-07-22 11:46:36


Author: fmhess
Date: 2009-07-22 11:46:35 EDT (Wed, 22 Jul 2009)
New Revision: 55082
URL: http://svn.boost.org/trac/boost/changeset/55082

Log:
Moved generic pointer definitions into boost::generic_ptr namespace. Moved
generic pointer headers into boost/generic_ptr directory.

Added:
   sandbox/fmhess/boost/generic_ptr/
   sandbox/fmhess/boost/generic_ptr/enable_shared_from_this.hpp (contents, props changed)
      - copied, changed from r55079, /sandbox/fmhess/boost/smart_ptr/enable_generic_shared_from_this.hpp
   sandbox/fmhess/boost/generic_ptr/shared.hpp (contents, props changed)
      - copied, changed from r55079, /sandbox/fmhess/boost/smart_ptr/generic_shared.hpp
   sandbox/fmhess/boost/generic_ptr/weak.hpp (contents, props changed)
      - copied, changed from r55075, /sandbox/fmhess/boost/smart_ptr/generic_weak.hpp
Removed:
   sandbox/fmhess/boost/smart_ptr/enable_generic_shared_from_this.hpp
   sandbox/fmhess/boost/smart_ptr/generic_shared.hpp
   sandbox/fmhess/boost/smart_ptr/generic_weak.hpp
Text files modified:
   sandbox/fmhess/boost/generic_ptr/enable_shared_from_this.hpp | 43 ++++---
   sandbox/fmhess/boost/generic_ptr/shared.hpp | 227 +++++++++++++++++++--------------------
   sandbox/fmhess/boost/generic_ptr/weak.hpp | 65 +++++-----
   sandbox/fmhess/boost/smart_ptr/enable_shared_from_this.hpp | 6
   sandbox/fmhess/boost/smart_ptr/shared_ptr.hpp | 90 ++++++++++++---
   sandbox/fmhess/boost/smart_ptr/weak_ptr.hpp | 14 +-
   6 files changed, 248 insertions(+), 197 deletions(-)

Copied: sandbox/fmhess/boost/generic_ptr/enable_shared_from_this.hpp (from r55079, /sandbox/fmhess/boost/smart_ptr/enable_generic_shared_from_this.hpp)
==============================================================================
--- /sandbox/fmhess/boost/smart_ptr/enable_generic_shared_from_this.hpp (original)
+++ sandbox/fmhess/boost/generic_ptr/enable_shared_from_this.hpp 2009-07-22 11:46:35 EDT (Wed, 22 Jul 2009)
@@ -1,8 +1,8 @@
-#ifndef BOOST_SMART_PTR_ENABLE_GENERIC_SHARED_FROM_THIS_HPP_INCLUDED
-#define BOOST_SMART_PTR_ENABLE_GENERIC_SHARED_FROM_THIS_HPP_INCLUDED
+#ifndef BOOST_GENERIC_PTR_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED
+#define BOOST_GENERIC_PTR_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED
 
 //
-// enable_generic_shared_from_this.hpp
+// generic_ptr::enable_shared_from_this.hpp
 //
 // Copyright 2002, 2009 Peter Dimov
 // Copyright 2009 Frank Mori Hess
@@ -11,70 +11,73 @@
 // See accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt
 //
-// http://www.boost.org/libs/smart_ptr/enable_shared_from_this.html
+// http://www.boost.org/libs/generic_ptr
 //
 
-#include <boost/smart_ptr/generic_weak.hpp>
-#include <boost/smart_ptr/generic_shared.hpp>
+#include <boost/generic_ptr/weak.hpp>
+#include <boost/generic_ptr/shared.hpp>
 #include <boost/assert.hpp>
 #include <boost/config.hpp>
 
 namespace boost
 {
+namespace generic_ptr
+{
 
-template<class T> class enable_generic_shared_from_this
+template<class T> class enable_shared_from_this
 {
 protected:
 
- enable_generic_shared_from_this()
+ enable_shared_from_this()
     {
     }
 
- enable_generic_shared_from_this(enable_generic_shared_from_this const &)
+ enable_shared_from_this(enable_shared_from_this const &)
     {
     }
 
- enable_generic_shared_from_this & operator=(enable_generic_shared_from_this const &)
+ enable_shared_from_this & operator=(enable_shared_from_this const &)
     {
         return *this;
     }
 
- ~enable_generic_shared_from_this()
+ ~enable_shared_from_this()
     {
     }
 
 public:
 
- generic_shared<T> shared_from_this()
+ shared<T> shared_from_this()
     {
- generic_shared<T> p( weak_this_ );
+ shared<T> p( weak_this_ );
         BOOST_ASSERT( get_plain_old_pointer(p) == this );
         return p;
     }
 //FIXME: yikes! we need to make it easier to add/remove const from a generic pointer's value_type
- typename generic_shared<T>::template rebind<typename generic_shared<T>::value_type const>::other shared_from_this() const
+ typename shared<T>::template rebind<typename shared<T>::value_type const>::other shared_from_this() const
     {
- typename generic_shared<T>::template rebind<typename generic_shared<T>::value_type const>::other p( weak_this_ );
+ typename shared<T>::template rebind<typename shared<T>::value_type const>::other p( weak_this_ );
         BOOST_ASSERT( get_plain_old_pointer(p) == this );
         return p;
     }
 
 public: // actually private, but avoids compiler template friendship issues
 
- // Note: invoked automatically by generic_shared; do not call
- template<class X, class Y> void _internal_accept_owner( generic_shared<X> const * ppx, Y py ) const
+ // Note: invoked automatically by generic_ptr::shared; do not call
+ template<class X, class Y> void _internal_accept_owner( shared<X> const * ppx, Y py ) const
     {
         if( weak_this_.expired() )
         {
- weak_this_ = generic_shared<T>( *ppx, py );
+ weak_this_ = shared<T>( *ppx, py );
         }
     }
 
 private:
 
- mutable generic_weak<T> weak_this_;
+ mutable weak<T> weak_this_;
 };
 
+} // namespace generic_ptr
 } // namespace boost
 
-#endif // #ifndef BOOST_SMART_PTR_ENABLE_GENERIC_SHARED_FROM_THIS_HPP_INCLUDED
+#endif // #ifndef BOOST_GENERIC_PTR_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED

Copied: sandbox/fmhess/boost/generic_ptr/shared.hpp (from r55079, /sandbox/fmhess/boost/smart_ptr/generic_shared.hpp)
==============================================================================
--- /sandbox/fmhess/boost/smart_ptr/generic_shared.hpp (original)
+++ sandbox/fmhess/boost/generic_ptr/shared.hpp 2009-07-22 11:46:35 EDT (Wed, 22 Jul 2009)
@@ -1,8 +1,8 @@
-#ifndef BOOST_SMART_PTR_GENERIC_SHARED_HPP_INCLUDED
-#define BOOST_SMART_PTR_GENERIC_SHARED_HPP_INCLUDED
+#ifndef BOOST_GENERIC_PTR_SHARED_HPP_INCLUDED
+#define BOOST_GENERIC_PTR_SHARED_HPP_INCLUDED
 
 //
-// generic_shared.hpp
+// generic_ptr/shared.hpp
 //
 // (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
 // Copyright (c) 2001-2008 Peter Dimov
@@ -12,13 +12,13 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 //
-// See http://www.boost.org/libs/smart_ptr/generic_shared.htm for documentation.
+// See http://www.boost.org/libs/generic_ptr for documentation.
 //
 
 // requirements for generic pointer type:
 // Must be either ordinary pointer, or provide:
 // operator->() and operator*()
-// value_type/reference/pointer member typedefs (or specialization of boost::generic_pointer_traits)
+// value_type/reference/pointer member typedefs (or specialization of boost::generic_ptr::pointer_traits)
 // (in)equality comparison
 // 2 argument static/const/dynamic_pointer_cast findable by ADL if you want support for casting
 // get_pointer support
@@ -72,47 +72,49 @@
 
 namespace boost
 {
+namespace generic_ptr
+{
 
-template<typename T> class generic_shared;
-template<typename T> class generic_weak;
-template<typename T> class enable_generic_shared_from_this;
+template<typename T> class shared;
+template<typename T> class weak;
+template<typename T> class enable_shared_from_this;
 
-template<typename T> struct generic_pointer_traits
+template<typename T> struct pointer_traits
 {
     typedef typename T::value_type value_type;
     typedef typename T::pointer pointer;
     typedef typename T::reference reference;
 };
 
-template<typename T> struct generic_pointer_traits<T*>
+template<typename T> struct pointer_traits<T*>
 {
     typedef T value_type;
     typedef T * pointer;
     typedef T & reference;
 };
 
-template<> struct generic_pointer_traits<void*>
+template<> struct pointer_traits<void*>
 {
     typedef void value_type;
     typedef void * pointer;
     typedef void reference;
 };
 
-template<> struct generic_pointer_traits<const void*>
+template<> struct pointer_traits<const void*>
 {
     typedef void value_type;
     typedef const void * pointer;
     typedef void reference;
 };
 
-template<> struct generic_pointer_traits<volatile void*>
+template<> struct pointer_traits<volatile void*>
 {
     typedef void value_type;
     typedef volatile void * pointer;
     typedef void reference;
 };
 
-template<> struct generic_pointer_traits<const volatile void*>
+template<> struct pointer_traits<const volatile void*>
 {
     typedef void value_type;
     typedef const volatile void * pointer;
@@ -120,13 +122,13 @@
 };
 
 template<typename GenericPtr, typename ValueType>
-struct rebind_generic_pointer
+struct rebind
 {
     typedef typename GenericPtr::template rebind<ValueType>::other other;
 };
 
 template<typename T, typename ValueType>
-struct rebind_generic_pointer<T*, ValueType>
+struct rebind<T*, ValueType>
 {
     typedef ValueType * other;
 };
@@ -138,7 +140,7 @@
 }
 
 template<typename GenericPtr>
-typename generic_pointer_traits<GenericPtr>::value_type *
+typename pointer_traits<GenericPtr>::value_type *
     get_plain_old_pointer(GenericPtr gp)
 {
     using boost::get_pointer;
@@ -164,7 +166,7 @@
     return dynamic_cast<T*>(r);
 }
 
-namespace gs_detail
+namespace detail
 {
 
 struct static_cast_tag {};
@@ -173,13 +175,13 @@
 
 // enable_shared_from_this support
 
-template< class X, class Y, class T > inline void sp_enable_shared_from_this( boost::generic_shared<X> const * ppx, Y const * py,
- boost::enable_generic_shared_from_this< T > const * pe )
+template< class X, class Y, class T > inline void sp_enable_shared_from_this( shared<X> const * ppx, Y const * py,
+ enable_shared_from_this< T > const * pe )
 {
     if( pe != 0 )
     {
- typedef typename remove_const<typename generic_pointer_traits<Y>::value_type>::type nonconst_y_value_type;
- pe->_internal_accept_owner( ppx, const_pointer_cast<nonconst_y_value_type>( *py ) );
+ typedef typename remove_const<typename pointer_traits<Y>::value_type>::type nonconst_y_value_type;
+ pe->_internal_accept_owner( ppx, const_pointer_cast( *py, mpl::identity<nonconst_y_value_type>()) );
     }
 }
 
@@ -221,7 +223,7 @@
 
 template<typename Y, typename T>
 class sp_enable_if_convertible: public
- detail::sp_enable_if_convertible<typename generic_pointer_traits<Y>::value_type, typename generic_pointer_traits<T>::value_type>
+ boost::detail::sp_enable_if_convertible<typename pointer_traits<Y>::value_type, typename pointer_traits<T>::value_type>
 {};
 
 template<typename T>
@@ -233,77 +235,75 @@
         p = 0;
 }
 
-} // namespace gs_detail
+} // namespace detail
 
 
 //
-// generic_shared
-//
-// An enhanced relative of scoped_ptr with reference counted copy semantics.
-// The object pointed to is deleted when the last generic_shared pointing to it
-// is destroyed or reset.
+// generic_ptr::shared
 //
+// A generalization of boost::shared_ptr which accepts a generic pointer type as
+// its wrapped pointer.
 
-template<class T> class generic_shared
+template<class T> class shared
 {
 private:
 
     // Borland 5.5.1 specific workaround
- typedef generic_shared<T> this_type;
+ typedef shared<T> this_type;
 
 public:
 
- typedef typename boost::generic_pointer_traits<T>::value_type element_type;
- typedef typename boost::generic_pointer_traits<T>::value_type value_type;
+ typedef typename pointer_traits<T>::value_type element_type;
+ typedef typename pointer_traits<T>::value_type value_type;
     typedef T pointer;
- typedef typename boost::generic_pointer_traits<T>::reference reference;
- typedef generic_weak<T> weak_type;
+ typedef typename pointer_traits<T>::reference reference;
+ typedef weak<T> weak_type;
 
     template<typename ValueType>
     struct rebind
     {
- typedef generic_shared<typename rebind_generic_pointer<pointer, ValueType>::other > other;
+ typedef shared<typename generic_ptr::rebind<pointer, ValueType>::other > other;
     };
 
- generic_shared(): px(), pn()
+ shared(): px(), pn()
     {
     }
 
     template<class Y>
- explicit generic_shared( Y p ): px( p ), pn( p ) // Y must be complete
+ explicit shared( Y p ): px( p ), pn( p ) // Y must be complete
     {
- boost::gs_detail::sp_enable_shared_from_this( this, &p, get_plain_old_pointer(p) );
+ detail::sp_enable_shared_from_this( this, &p, get_plain_old_pointer(p) );
     }
 
     //
     // Requirements: D's copy constructor must not throw
     //
- // generic_shared will release p by calling d(p)
+ // shared will release p by calling d(p)
     //
 
- template<class Y, class D> generic_shared(Y p, D d): px(p), pn(p, d)
+ template<class Y, class D> shared(Y p, D d): px(p), pn(p, d)
     {
- boost::gs_detail::sp_enable_shared_from_this( this, &p, get_plain_old_pointer(p) );
+ detail::sp_enable_shared_from_this( this, &p, get_plain_old_pointer(p) );
     }
 
     // As above, but with allocator. A's copy constructor shall not throw.
 
- template<class Y, class D, class A> generic_shared( Y p, D d, A a ): px( p ), pn( p, d, a )
+ template<class Y, class D, class A> shared( Y p, D d, A a ): px( p ), pn( p, d, a )
     {
- boost::gs_detail::sp_enable_shared_from_this( this, &p, get_plain_old_pointer(p) );
+ detail::sp_enable_shared_from_this( this, &p, get_plain_old_pointer(p) );
     }
 
 // generated copy constructor, destructor are fine
 
     template<class Y>
- explicit generic_shared(generic_weak<Y> const & r): pn(r.pn) // may throw
+ explicit shared(weak<Y> const & r): pn(r.pn) // may throw
     {
         // it is now safe to copy r.px, as pn(r.pn) did not throw
         px = r.px;
     }
 
     template<class Y>
- generic_shared( generic_weak<Y> const & r, boost::detail::sp_nothrow_tag ): px( 0 ), pn( r.pn, boost::detail::sp_nothrow_tag() ) // never throws
+ shared( weak<Y> const & r, boost::detail::sp_nothrow_tag ): px( 0 ), pn( r.pn, boost::detail::sp_nothrow_tag() ) // never throws
     {
         if( !pn.empty() )
         {
@@ -314,11 +314,11 @@
     template<class Y>
 #if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
 
- generic_shared( generic_shared<Y> const & r, typename gs_detail::sp_enable_if_convertible<Y,T>::type = detail::sp_empty() )
+ shared( shared<Y> const & r, typename detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() )
 
 #else
 
- generic_shared( generic_shared<Y> const & r )
+ shared( shared<Y> const & r )
 
 #endif
     : px( r.px ), pn( r.pn ) // never throws
@@ -327,26 +327,26 @@
 
     // aliasing
     template< class Y, class Z >
- generic_shared( generic_shared<Y> const & r, Z p ): px( p ), pn( r.pn ) // never throws
+ shared( shared<Y> const & r, Z p ): px( p ), pn( r.pn ) // never throws
     {
     }
 
     template<class Y>
- generic_shared(generic_shared<Y> const & r, boost::gs_detail::static_cast_tag):
+ shared(shared<Y> const & r, detail::static_cast_tag):
         px(static_pointer_cast(r.px, boost::mpl::identity<value_type>())),
         pn(r.pn)
     {
     }
 
     template<class Y>
- generic_shared(generic_shared<Y> const & r, boost::gs_detail::const_cast_tag):
+ shared(shared<Y> const & r, detail::const_cast_tag):
         px(const_pointer_cast(r.px, boost::mpl::identity<value_type>())),
         pn(r.pn)
     {
     }
 
     template<class Y>
- generic_shared(generic_shared<Y> const & r, boost::gs_detail::dynamic_cast_tag):
+ shared(shared<Y> const & r, detail::dynamic_cast_tag):
         px(dynamic_pointer_cast(r.px, boost::mpl::identity<value_type>())),
         pn(r.pn)
     {
@@ -359,21 +359,21 @@
 #ifndef BOOST_NO_AUTO_PTR
 
     template<class Y>
- explicit generic_shared(std::auto_ptr<Y> & r): px(r.get()), pn()
+ explicit shared(std::auto_ptr<Y> & r): px(r.get()), pn()
     {
         Y * tmp = r.get();
         pn = boost::detail::shared_count(r);
- boost::gs_detail::sp_enable_shared_from_this( this, &tmp, get_plain_old_pointer(tmp) );
+ detail::sp_enable_shared_from_this( this, &tmp, get_plain_old_pointer(tmp) );
     }
 
 #if !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
 
     template<class Ap>
- explicit generic_shared( Ap r, typename boost::gs_detail::sp_enable_if_auto_ptr<Ap, int>::type = 0 ): px( r.get() ), pn()
+ explicit shared( Ap r, typename detail::sp_enable_if_auto_ptr<Ap, int>::type = 0 ): px( r.get() ), pn()
     {
         typename Ap::element_type * tmp = r.get();
         pn = boost::detail::shared_count( r );
- boost::gs_detail::sp_enable_shared_from_this( this, &tmp, get_plain_old_pointer(tmp) );
+ detail::sp_enable_shared_from_this( this, &tmp, get_plain_old_pointer(tmp) );
     }
 
 
@@ -383,7 +383,7 @@
 
     // assignment
 
- generic_shared & operator=( generic_shared const & r ) // never throws
+ shared & operator=( shared const & r ) // never throws
     {
         this_type(r).swap(*this);
         return *this;
@@ -392,7 +392,7 @@
 #if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1400)
 
     template<class Y>
- generic_shared & operator=(generic_shared<Y> const & r) // never throws
+ shared & operator=(shared<Y> const & r) // never throws
     {
         this_type(r).swap(*this);
         return *this;
@@ -403,7 +403,7 @@
 #ifndef BOOST_NO_AUTO_PTR
 
     template<class Y>
- generic_shared & operator=( std::auto_ptr<Y> & r )
+ shared & operator=( std::auto_ptr<Y> & r )
     {
         this_type(r).swap(*this);
         return *this;
@@ -412,7 +412,7 @@
 #if !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
 
     template<class Ap>
- typename boost::gs_detail::sp_enable_if_auto_ptr< Ap, generic_shared & >::type operator=( Ap r )
+ typename detail::sp_enable_if_auto_ptr< Ap, shared & >::type operator=( Ap r )
     {
         this_type( r ).swap( *this );
         return *this;
@@ -427,36 +427,36 @@
 
 #if defined( BOOST_HAS_RVALUE_REFS )
 
- generic_shared( generic_shared && r ): px( r.px ), pn() // never throws
+ shared( shared && r ): px( r.px ), pn() // never throws
     {
         pn.swap( r.pn );
- gs_detail::set_plain_pointer_to_null(r.px);
+ detail::set_plain_pointer_to_null(r.px);
     }
 
     template<class Y>
 #if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
 
- generic_shared( generic_shared<Y> && r, typename gs_detail::sp_enable_if_convertible<Y,T>::type = detail::sp_empty() )
+ shared( shared<Y> && r, typename detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() )
 
 #else
 
- generic_shared( generic_shared<Y> && r )
+ shared( shared<Y> && r )
 
 #endif
     : px( r.px ), pn() // never throws
     {
         pn.swap( r.pn );
- gs_detail::set_plain_pointer_to_null(r.px);
+ detail::set_plain_pointer_to_null(r.px);
     }
 
- generic_shared & operator=( generic_shared && r ) // never throws
+ shared & operator=( shared && r ) // never throws
     {
         this_type( std::move( r ) ).swap( *this );
         return *this;
     }
 
     template<class Y>
- generic_shared & operator=( generic_shared<Y> && r ) // never throws
+ shared & operator=( shared<Y> && r ) // never throws
     {
         this_type( std::move( r ) ).swap( *this );
         return *this;
@@ -484,7 +484,7 @@
         this_type( p, d, a ).swap( *this );
     }
 
- template<class Y> void reset( generic_shared<Y> const & r, T p )
+ template<class Y> void reset( shared<Y> const & r, T p )
     {
         this_type( r, p ).swap( *this );
     }
@@ -507,16 +507,6 @@
     }
 
 // implicit conversion to "bool"
-#if 0
-#include <boost/smart_ptr/detail/generic_operator_bool.hpp>
-#else
-// This header intentionally has no include guards.
-//
-// Copyright (c) 2001-2009 Peter Dimov
-//
-// Distributed under the Boost Software License, Version 1.0.
-// See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt
 
 #if ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, < 0x570) ) || defined(__CINT__)
 
@@ -566,7 +556,6 @@
     {
         return get_plain_old_pointer(px) == 0;
     }
-#endif // end implicit conversion to "bool" support
 
     bool unique() const // never throws
     {
@@ -578,23 +567,23 @@
         return pn.use_count();
     }
 
- void swap(generic_shared<T> & other) // never throws
+ void swap(shared<T> & other) // never throws
     {
         std::swap(px, other.px);
         pn.swap(other.pn);
     }
 
- template<class Y> bool _internal_less(generic_shared<Y> const & rhs) const
+ template<class Y> bool _internal_less(shared<Y> const & rhs) const
     {
         return pn < rhs.pn;
     }
 
- void * _internal_get_deleter( detail::sp_typeinfo const & ti ) const
+ void * _internal_get_deleter( boost::detail::sp_typeinfo const & ti ) const
     {
         return pn.get_deleter( ti );
     }
 
- bool _internal_equiv( generic_shared const & r ) const
+ bool _internal_equiv( shared const & r ) const
     {
         return px == r.px && pn == r.pn;
     }
@@ -606,8 +595,8 @@
 
 private:
 
- template<class Y> friend class generic_shared;
- template<class Y> friend class generic_weak;
+ template<class Y> friend class shared;
+ template<class Y> friend class weak;
 
 
 #endif
@@ -615,14 +604,14 @@
     T px; // contained pointer
     boost::detail::shared_count pn; // reference counter
 
-}; // generic_shared
+}; // shared
 
-template<class T, class U> inline bool operator==(generic_shared<T> const & a, generic_shared<U> const & b)
+template<class T, class U> inline bool operator==(shared<T> const & a, shared<U> const & b)
 {
     return a.get() == b.get();
 }
 
-template<class T, class U> inline bool operator!=(generic_shared<T> const & a, generic_shared<U> const & b)
+template<class T, class U> inline bool operator!=(shared<T> const & a, shared<U> const & b)
 {
     return a.get() != b.get();
 }
@@ -631,49 +620,50 @@
 
 // Resolve the ambiguity between our op!= and the one in rel_ops
 
-template<class T> inline bool operator!=(generic_shared<T> const & a, generic_shared<T> const & b)
+template<class T> inline bool operator!=(shared<T> const & a, shared<T> const & b)
 {
     return a.get() != b.get();
 }
 
 #endif
 
-template<class T, class U> inline bool operator<(generic_shared<T> const & a, generic_shared<U> const & b)
+template<class T, class U> inline bool operator<(shared<T> const & a, shared<U> const & b)
 {
     return a._internal_less(b);
 }
 
-template<class T> inline void swap(generic_shared<T> & a, generic_shared<T> & b)
+template<class T> inline void swap(shared<T> & a, shared<T> & b)
 {
     a.swap(b);
 }
 
 template<typename ToValueType, typename U>
-typename generic_shared<U>::template rebind<ToValueType>::other static_pointer_cast(generic_shared<U> const & r,
+typename shared<U>::template rebind<ToValueType>::other static_pointer_cast(shared<U> const & r,
     boost::mpl::identity<ToValueType> = boost::mpl::identity<ToValueType>())
 {
- typedef typename generic_shared<U>::template rebind<ToValueType>::other result_type;
- return result_type(r, boost::gs_detail::static_cast_tag());
+ typedef typename shared<U>::template rebind<ToValueType>::other result_type;
+ return result_type(r, detail::static_cast_tag());
 }
 
 template<typename ToValueType, typename U>
-typename generic_shared<U>::template rebind<ToValueType>::other const_pointer_cast(generic_shared<U> const & r,
+typename shared<U>::template rebind<ToValueType>::other const_pointer_cast(shared<U> const & r,
     boost::mpl::identity<ToValueType> = boost::mpl::identity<ToValueType>())
 {
- typedef typename generic_shared<U>::template rebind<ToValueType>::other result_type;
- return result_type(r, boost::gs_detail::const_cast_tag());
+ typedef typename shared<U>::template rebind<ToValueType>::other result_type;
+ return result_type(r, detail::const_cast_tag());
 }
 
 template<typename ToValueType, typename U>
-typename generic_shared<U>::template rebind<ToValueType>::other dynamic_pointer_cast(generic_shared<U> const & r,
+typename shared<U>::template rebind<ToValueType>::other dynamic_pointer_cast(shared<U> const & r,
     boost::mpl::identity<ToValueType> = boost::mpl::identity<ToValueType>())
 {
- typedef typename generic_shared<U>::template rebind<ToValueType>::other result_type;
- return result_type(r, boost::gs_detail::dynamic_cast_tag());
+ typedef typename shared<U>::template rebind<ToValueType>::other result_type;
+ return result_type(r, detail::dynamic_cast_tag());
 }
 
-// get_pointer() enables boost::mem_fn to recognize generic_shared
-template<class T> inline T get_pointer(generic_shared<T> const & p)
+// get_pointer() enables boost::mem_fn to recognize generic_ptr::shared
+// and is required by generic_ptr::get_plain_old_pointer()
+template<class T> inline T get_pointer(shared<T> const & p)
 {
     return p.get();
 }
@@ -684,7 +674,7 @@
 
 #if defined(BOOST_NO_TEMPLATED_IOSTREAMS) || ( defined(__GNUC__) && (__GNUC__ < 3) )
 
-template<class Y> std::ostream & operator<< (std::ostream & os, generic_shared<Y> const & p)
+template<class Y> std::ostream & operator<< (std::ostream & os, shared<Y> const & p)
 {
     os << p.get();
     return os;
@@ -698,9 +688,9 @@
 # if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300 && __SGI_STL_PORT)
 // MSVC6 has problems finding std::basic_ostream through the using declaration in namespace _STL
 using std::basic_ostream;
-template<class E, class T, class Y> basic_ostream<E, T> & operator<< (basic_ostream<E, T> & os, generic_shared<Y> const & p)
+template<class E, class T, class Y> basic_ostream<E, T> & operator<< (basic_ostream<E, T> & os, shared<Y> const & p)
 # else
-template<class E, class T, class Y> std::basic_ostream<E, T> & operator<< (std::basic_ostream<E, T> & os, generic_shared<Y> const & p)
+template<class E, class T, class Y> std::basic_ostream<E, T> & operator<< (std::basic_ostream<E, T> & os, shared<Y> const & p)
 # endif
 {
     os << p.get();
@@ -722,7 +712,7 @@
 // g++ 2.9x doesn't allow static_cast<X const *>(void *)
 // apparently EDG 2.38 and HP aCC A.03.35 also don't accept it
 
-template<class D, class T> D * get_deleter(generic_shared<T> const & p)
+template<class D, class T> D * get_deleter(shared<T> const & p)
 {
     void const * q = p._internal_get_deleter(BOOST_SP_TYPEID(D));
     return const_cast<D *>(static_cast<D const *>(q));
@@ -730,7 +720,7 @@
 
 #else
 
-template<class D, class T> D * get_deleter(generic_shared<T> const & p)
+template<class D, class T> D * get_deleter(shared<T> const & p)
 {
     return static_cast<D *>(p._internal_get_deleter(BOOST_SP_TYPEID(D)));
 }
@@ -741,34 +731,34 @@
 
 #if !defined(BOOST_SP_NO_ATOMIC_ACCESS)
 
-template<class T> inline bool atomic_is_lock_free( generic_shared<T> const * /*p*/ )
+template<class T> inline bool atomic_is_lock_free( shared<T> const * /*p*/ )
 {
     return false;
 }
 
-template<class T> generic_shared<T> atomic_load( generic_shared<T> const * p )
+template<class T> shared<T> atomic_load( shared<T> const * p )
 {
     boost::detail::spinlock_pool<2>::scoped_lock lock( p );
     return *p;
 }
 
-template<class T> inline generic_shared<T> atomic_load_explicit( generic_shared<T> const * p, memory_order /*mo*/ )
+template<class T> inline shared<T> atomic_load_explicit( shared<T> const * p, memory_order /*mo*/ )
 {
     return atomic_load( p );
 }
 
-template<class T> void atomic_store( generic_shared<T> * p, generic_shared<T> r )
+template<class T> void atomic_store( shared<T> * p, shared<T> r )
 {
     boost::detail::spinlock_pool<2>::scoped_lock lock( p );
     p->swap( r );
 }
 
-template<class T> inline void atomic_store_explicit( generic_shared<T> * p, generic_shared<T> r, memory_order /*mo*/ )
+template<class T> inline void atomic_store_explicit( shared<T> * p, shared<T> r, memory_order /*mo*/ )
 {
     atomic_store( p, r ); // std::move( r )
 }
 
-template<class T> generic_shared<T> atomic_exchange( generic_shared<T> * p, generic_shared<T> r )
+template<class T> shared<T> atomic_exchange( shared<T> * p, shared<T> r )
 {
     boost::detail::spinlock & sp = boost::detail::spinlock_pool<2>::spinlock_for( p );
 
@@ -779,12 +769,12 @@
     return r; // return std::move( r )
 }
 
-template<class T> generic_shared<T> atomic_exchange_explicit( generic_shared<T> * p, generic_shared<T> r, memory_order /*mo*/ )
+template<class T> shared<T> atomic_exchange_explicit( shared<T> * p, shared<T> r, memory_order /*mo*/ )
 {
     return atomic_exchange( p, r ); // std::move( r )
 }
 
-template<class T> bool atomic_compare_exchange( generic_shared<T> * p, generic_shared<T> * v, generic_shared<T> w )
+template<class T> bool atomic_compare_exchange( shared<T> * p, shared<T> * v, shared<T> w )
 {
     boost::detail::spinlock & sp = boost::detail::spinlock_pool<2>::spinlock_for( p );
 
@@ -800,7 +790,7 @@
     }
     else
     {
- generic_shared<T> tmp( *p );
+ shared<T> tmp( *p );
 
         sp.unlock();
 
@@ -809,13 +799,14 @@
     }
 }
 
-template<class T> inline bool atomic_compare_exchange_explicit( generic_shared<T> * p, generic_shared<T> * v, generic_shared<T> w, memory_order /*success*/, memory_order /*failure*/ )
+template<class T> inline bool atomic_compare_exchange_explicit( shared<T> * p, shared<T> * v, shared<T> w, memory_order /*success*/, memory_order /*failure*/ )
 {
     return atomic_compare_exchange( p, v, w ); // std::move( w )
 }
 
 #endif
 
+} // namespace generic_ptr
 } // namespace boost
 
 #ifdef BOOST_MSVC
@@ -824,4 +815,4 @@
 
 #endif // #if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES)
 
-#endif // #ifndef BOOST_SMART_PTR_SHARED_HPP_INCLUDED
+#endif // #ifndef BOOST_GENERIC_PTR_SHARED_HPP_INCLUDED

Copied: sandbox/fmhess/boost/generic_ptr/weak.hpp (from r55075, /sandbox/fmhess/boost/smart_ptr/generic_weak.hpp)
==============================================================================
--- /sandbox/fmhess/boost/smart_ptr/generic_weak.hpp (original)
+++ sandbox/fmhess/boost/generic_ptr/weak.hpp 2009-07-22 11:46:35 EDT (Wed, 22 Jul 2009)
@@ -2,7 +2,7 @@
 #define BOOST_SMART_PTR_GENERIC_WEAK_HPP_INCLUDED
 
 //
-// generic_weak.hpp
+// generic_ptr/weak.hpp
 //
 // Copyright (c) 2001, 2002, 2003 Peter Dimov
 // Copyright (c) 2009 Frank Mori Hess
@@ -11,12 +11,12 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 //
-// See http://www.boost.org/libs/smart_ptr/generic_weak.htm for documentation.
+// See http://www.boost.org/libs/generic_ptr for documentation.
 //
 
 #include <memory> // boost.TR1 include order fix
 #include <boost/smart_ptr/detail/shared_count.hpp>
-#include <boost/smart_ptr/generic_shared.hpp>
+#include <boost/generic_ptr/shared.hpp>
 
 #ifdef BOOST_MSVC // moved here to work around VC++ compiler crash
 # pragma warning(push)
@@ -25,21 +25,23 @@
 
 namespace boost
 {
+namespace generic_ptr
+{
 
-template<class T> class generic_weak
+template<class T> class weak
 {
 private:
 
     // Borland 5.5.1 specific workarounds
- typedef generic_weak<T> this_type;
+ typedef weak<T> this_type;
 
 public:
 
- typedef typename generic_pointer_traits<T>::value_type element_type;
- typedef typename generic_pointer_traits<T>::value_type value_type;
- typedef generic_shared<T> shared_type;
+ typedef typename pointer_traits<T>::value_type element_type;
+ typedef typename pointer_traits<T>::value_type value_type;
+ typedef shared<T> shared_type;
 
- generic_weak(): px(), pn() // never throws in 1.30+
+ weak(): px(), pn() // never throws in 1.30+
     {
     }
 
@@ -50,7 +52,7 @@
 // The "obvious" converting constructor implementation:
 //
 // template<class Y>
-// generic_weak(generic_weak<Y> const & r): px(r.px), pn(r.pn) // never throws
+// weak(generic_weak<Y> const & r): px(r.px), pn(r.pn) // never throws
 // {
 // }
 //
@@ -66,11 +68,11 @@
     template<class Y>
 #if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
 
- generic_weak( generic_weak<Y> const & r, typename gs_detail::sp_enable_if_convertible<Y,T>::type = detail::sp_empty() )
+ weak( weak<Y> const & r, typename detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() )
 
 #else
 
- generic_weak( generic_weak<Y> const & r )
+ weak( weak<Y> const & r )
 
 #endif
     : px(r.lock().get()), pn(r.pn) // never throws
@@ -82,26 +84,26 @@
     template<class Y>
 #if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
 
- generic_weak( generic_weak<Y> && r, typename gs_detail::sp_enable_if_convertible<Y,T>::type = detail::sp_empty() )
+ weak( weak<Y> && r, typename detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() )
 
 #else
 
- generic_weak( generic_weak<Y> && r )
+ weak( weak<Y> && r )
 
 #endif
     : px(r.lock().get()), pn(std::move(r.pn)) // never throws
     {
- gs_detail::set_plain_pointer_to_null(r.px);
+ detail::set_plain_pointer_to_null(r.px);
     }
 
     // for better efficiency in the T == Y case
- generic_weak( generic_weak && r ): px( r.px ), pn(std::move(r.pn)) // never throws
+ weak( weak && r ): px( r.px ), pn(std::move(r.pn)) // never throws
     {
- gs_detail::set_plain_pointer_to_null(r.px);
+ detail::set_plain_pointer_to_null(r.px);
     }
 
     // for better efficiency in the T == Y case
- generic_weak & operator=( generic_weak && r ) // never throws
+ weak & operator=( weak && r ) // never throws
     {
         this_type( std::move( r ) ).swap( *this );
         return *this;
@@ -113,11 +115,11 @@
     template<class Y>
 #if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
 
- generic_weak( generic_shared<Y> const & r, typename gs_detail::sp_enable_if_convertible<Y,T>::type = detail::sp_empty() )
+ weak( shared<Y> const & r, typename detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() )
 
 #else
 
- generic_weak( generic_shared<Y> const & r )
+ weak( shared<Y> const & r )
 
 #endif
     : px( r.px ), pn( r.pn ) // never throws
@@ -127,7 +129,7 @@
 #if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1300)
 
     template<class Y>
- generic_weak & operator=(generic_weak<Y> const & r) // never throws
+ weak & operator=(weak<Y> const & r) // never throws
     {
         px = r.lock().get();
         pn = r.pn;
@@ -137,7 +139,7 @@
 #if defined( BOOST_HAS_RVALUE_REFS )
 
     template<class Y>
- generic_weak & operator=(generic_weak<Y> && r)
+ weak & operator=(weak<Y> && r)
     {
         this_type( std::move( r ) ).swap( *this );
         return *this;
@@ -146,7 +148,7 @@
 #endif
 
     template<class Y>
- generic_weak & operator=(generic_shared<Y> const & r) // never throws
+ weak & operator=(shared<Y> const & r) // never throws
     {
         px = r.px;
         pn = r.pn;
@@ -155,9 +157,9 @@
 
 #endif
 
- generic_shared<T> lock() const // never throws
+ shared<T> lock() const // never throws
     {
- return generic_shared<T>( *this, boost::detail::sp_nothrow_tag() );
+ return shared<T>( *this, boost::detail::sp_nothrow_tag() );
     }
 
     long use_count() const // never throws
@@ -192,7 +194,7 @@
         pn = pn2;
     }
 
- template<class Y> bool _internal_less(generic_weak<Y> const & rhs) const
+ template<class Y> bool _internal_less(weak<Y> const & rhs) const
     {
         return pn < rhs.pn;
     }
@@ -204,26 +206,27 @@
 
 private:
 
- template<class Y> friend class generic_weak;
- template<class Y> friend class generic_shared;
+ template<class Y> friend class weak;
+ template<class Y> friend class shared;
 
 #endif
 
     T px; // contained pointer
     boost::detail::weak_count pn; // reference counter
 
-}; // generic_weak
+}; // weak
 
-template<class T, class U> inline bool operator<(generic_weak<T> const & a, generic_weak<U> const & b)
+template<class T, class U> inline bool operator<(weak<T> const & a, weak<U> const & b)
 {
     return a._internal_less(b);
 }
 
-template<class T> void swap(generic_weak<T> & a, generic_weak<T> & b)
+template<class T> void swap(weak<T> & a, weak<T> & b)
 {
     a.swap(b);
 }
 
+} // namespace generic_ptr
 } // namespace boost
 
 #ifdef BOOST_MSVC

Deleted: sandbox/fmhess/boost/smart_ptr/enable_generic_shared_from_this.hpp
==============================================================================
--- sandbox/fmhess/boost/smart_ptr/enable_generic_shared_from_this.hpp 2009-07-22 11:46:35 EDT (Wed, 22 Jul 2009)
+++ (empty file)
@@ -1,80 +0,0 @@
-#ifndef BOOST_SMART_PTR_ENABLE_GENERIC_SHARED_FROM_THIS_HPP_INCLUDED
-#define BOOST_SMART_PTR_ENABLE_GENERIC_SHARED_FROM_THIS_HPP_INCLUDED
-
-//
-// enable_generic_shared_from_this.hpp
-//
-// Copyright 2002, 2009 Peter Dimov
-// Copyright 2009 Frank Mori Hess
-//
-// Distributed under the Boost Software License, Version 1.0.
-// See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt
-//
-// http://www.boost.org/libs/smart_ptr/enable_shared_from_this.html
-//
-
-#include <boost/smart_ptr/generic_weak.hpp>
-#include <boost/smart_ptr/generic_shared.hpp>
-#include <boost/assert.hpp>
-#include <boost/config.hpp>
-
-namespace boost
-{
-
-template<class T> class enable_generic_shared_from_this
-{
-protected:
-
- enable_generic_shared_from_this()
- {
- }
-
- enable_generic_shared_from_this(enable_generic_shared_from_this const &)
- {
- }
-
- enable_generic_shared_from_this & operator=(enable_generic_shared_from_this const &)
- {
- return *this;
- }
-
- ~enable_generic_shared_from_this()
- {
- }
-
-public:
-
- generic_shared<T> shared_from_this()
- {
- generic_shared<T> p( weak_this_ );
- BOOST_ASSERT( get_plain_old_pointer(p) == this );
- return p;
- }
-//FIXME: yikes! we need to make it easier to add/remove const from a generic pointer's value_type
- typename generic_shared<T>::template rebind<typename generic_shared<T>::value_type const>::other shared_from_this() const
- {
- typename generic_shared<T>::template rebind<typename generic_shared<T>::value_type const>::other p( weak_this_ );
- BOOST_ASSERT( get_plain_old_pointer(p) == this );
- return p;
- }
-
-public: // actually private, but avoids compiler template friendship issues
-
- // Note: invoked automatically by generic_shared; do not call
- template<class X, class Y> void _internal_accept_owner( generic_shared<X> const * ppx, Y py ) const
- {
- if( weak_this_.expired() )
- {
- weak_this_ = generic_shared<T>( *ppx, py );
- }
- }
-
-private:
-
- mutable generic_weak<T> weak_this_;
-};
-
-} // namespace boost
-
-#endif // #ifndef BOOST_SMART_PTR_ENABLE_GENERIC_SHARED_FROM_THIS_HPP_INCLUDED

Modified: sandbox/fmhess/boost/smart_ptr/enable_shared_from_this.hpp
==============================================================================
--- sandbox/fmhess/boost/smart_ptr/enable_shared_from_this.hpp (original)
+++ sandbox/fmhess/boost/smart_ptr/enable_shared_from_this.hpp 2009-07-22 11:46:35 EDT (Wed, 22 Jul 2009)
@@ -12,14 +12,14 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#include <boost/smart_ptr/enable_generic_shared_from_this.hpp>
+#include <boost/generic_ptr/enable_shared_from_this.hpp>
 
 namespace boost
 {
         template<typename T>
- class enable_shared_from_this: public enable_generic_shared_from_this<T*>
+ class enable_shared_from_this: public generic_ptr::enable_shared_from_this<T*>
         {
- typedef enable_generic_shared_from_this<T*> base_type;
+ typedef generic_ptr::enable_shared_from_this<T*> base_type;
                 public:
                 boost::shared_ptr<T> shared_from_this()
                 {

Deleted: sandbox/fmhess/boost/smart_ptr/generic_shared.hpp
==============================================================================
--- sandbox/fmhess/boost/smart_ptr/generic_shared.hpp 2009-07-22 11:46:35 EDT (Wed, 22 Jul 2009)
+++ (empty file)
@@ -1,827 +0,0 @@
-#ifndef BOOST_SMART_PTR_GENERIC_SHARED_HPP_INCLUDED
-#define BOOST_SMART_PTR_GENERIC_SHARED_HPP_INCLUDED
-
-//
-// generic_shared.hpp
-//
-// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
-// Copyright (c) 2001-2008 Peter Dimov
-// Copyright (c) 2009 Frank Mori Hess
-//
-// Distributed under the Boost Software License, Version 1.0. (See
-// accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-// See http://www.boost.org/libs/smart_ptr/generic_shared.htm for documentation.
-//
-
-// requirements for generic pointer type:
-// Must be either ordinary pointer, or provide:
-// operator->() and operator*()
-// value_type/reference/pointer member typedefs (or specialization of boost::generic_pointer_traits)
-// (in)equality comparison
-// 2 argument static/const/dynamic_pointer_cast findable by ADL if you want support for casting
-// get_pointer support
-// rebind member template for changing a pointer's value_type
-
-#include <boost/config.hpp> // for broken compiler workarounds
-
-#if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES)
-#include <boost/smart_ptr/detail/generic_shared_nmt.hpp>
-#else
-
-// In order to avoid circular dependencies with Boost.TR1
-// we make sure that our include of <memory> doesn't try to
-// pull in the TR1 headers: that's why we use this header
-// rather than including <memory> directly:
-#include <boost/config/no_tr1/memory.hpp> // std::auto_ptr
-
-#include <boost/assert.hpp>
-#include <boost/checked_delete.hpp>
-#include <boost/get_pointer.hpp>
-#include <boost/mpl/identity.hpp>
-#include <boost/pointer_cast.hpp>
-#include <boost/throw_exception.hpp>
-#include <boost/smart_ptr/detail/shared_count.hpp>
-#include <boost/detail/workaround.hpp>
-#include <boost/smart_ptr/detail/sp_convertible.hpp>
-#include <boost/type_traits/remove_const.hpp>
-#include <boost/utility/enable_if.hpp>
-
-#if !defined(BOOST_SP_NO_ATOMIC_ACCESS)
-#include <boost/smart_ptr/detail/spinlock_pool.hpp>
-#include <boost/memory_order.hpp>
-#endif
-
-#include <algorithm> // for std::swap
-#include <functional> // for std::less
-#include <typeinfo> // for std::bad_cast
-
-#if !defined(BOOST_NO_IOSTREAM)
-#if !defined(BOOST_NO_IOSFWD)
-#include <iosfwd> // for std::basic_ostream
-#else
-#include <ostream>
-#endif
-#endif
-
-#ifdef BOOST_MSVC // moved here to work around VC++ compiler crash
-# pragma warning(push)
-# pragma warning(disable:4284) // odd return type for operator->
-#endif
-
-namespace boost
-{
-
-template<typename T> class generic_shared;
-template<typename T> class generic_weak;
-template<typename T> class enable_generic_shared_from_this;
-
-template<typename T> struct generic_pointer_traits
-{
- typedef typename T::value_type value_type;
- typedef typename T::pointer pointer;
- typedef typename T::reference reference;
-};
-
-template<typename T> struct generic_pointer_traits<T*>
-{
- typedef T value_type;
- typedef T * pointer;
- typedef T & reference;
-};
-
-template<> struct generic_pointer_traits<void*>
-{
- typedef void value_type;
- typedef void * pointer;
- typedef void reference;
-};
-
-template<> struct generic_pointer_traits<const void*>
-{
- typedef void value_type;
- typedef const void * pointer;
- typedef void reference;
-};
-
-template<> struct generic_pointer_traits<volatile void*>
-{
- typedef void value_type;
- typedef volatile void * pointer;
- typedef void reference;
-};
-
-template<> struct generic_pointer_traits<const volatile void*>
-{
- typedef void value_type;
- typedef const volatile void * pointer;
- typedef void reference;
-};
-
-template<typename GenericPtr, typename ValueType>
-struct rebind_generic_pointer
-{
- typedef typename GenericPtr::template rebind<ValueType>::other other;
-};
-
-template<typename T, typename ValueType>
-struct rebind_generic_pointer<T*, ValueType>
-{
- typedef ValueType * other;
-};
-
-template<typename T>
-T * get_plain_old_pointer(T * p)
-{
- return p;
-}
-
-template<typename GenericPtr>
-typename generic_pointer_traits<GenericPtr>::value_type *
- get_plain_old_pointer(GenericPtr gp)
-{
- using boost::get_pointer;
- return get_plain_old_pointer(get_pointer(gp));
-}
-
-// two-argument cast overloads for raw pointers (really belongs in boost/pointer_cast.hpp)
-template<typename T, typename U>
-T* static_pointer_cast(U *r, boost::mpl::identity<T>)
-{
- return static_cast<T*>(r);
-}
-
-template<typename T, typename U>
-T* const_pointer_cast(U *r, boost::mpl::identity<T>)
-{
- return const_cast<T*>(r);
-}
-
-template<typename T, typename U>
-T* dynamic_pointer_cast(U *r, boost::mpl::identity<T>)
-{
- return dynamic_cast<T*>(r);
-}
-
-namespace gs_detail
-{
-
-struct static_cast_tag {};
-struct const_cast_tag {};
-struct dynamic_cast_tag {};
-
-// enable_shared_from_this support
-
-template< class X, class Y, class T > inline void sp_enable_shared_from_this( boost::generic_shared<X> const * ppx, Y const * py,
- boost::enable_generic_shared_from_this< T > const * pe )
-{
- if( pe != 0 )
- {
- typedef typename remove_const<typename generic_pointer_traits<Y>::value_type>::type nonconst_y_value_type;
- pe->_internal_accept_owner( ppx, const_pointer_cast<nonconst_y_value_type>( *py ) );
- }
-}
-
-#ifdef _MANAGED
-
-// Avoid C4793, ... causes native code generation
-
-struct sp_any_pointer
-{
- template<class T> sp_any_pointer( T* ) {}
-};
-
-inline void sp_enable_shared_from_this( sp_any_pointer, sp_any_pointer, sp_any_pointer )
-{
-}
-
-#else // _MANAGED
-
-inline void sp_enable_shared_from_this( ... )
-{
-}
-
-#endif // _MANAGED
-
-#if !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) && !defined( BOOST_NO_AUTO_PTR )
-
-// rvalue auto_ptr support based on a technique by Dave Abrahams
-
-template< class T, class R > struct sp_enable_if_auto_ptr
-{
-};
-
-template< class T, class R > struct sp_enable_if_auto_ptr< std::auto_ptr< T >, R >
-{
- typedef R type;
-};
-
-#endif
-
-template<typename Y, typename T>
-class sp_enable_if_convertible: public
- detail::sp_enable_if_convertible<typename generic_pointer_traits<Y>::value_type, typename generic_pointer_traits<T>::value_type>
-{};
-
-template<typename T>
-void set_plain_pointer_to_null(const T&)
-{}
-template<typename T>
-void set_plain_pointer_to_null(T * &p)
-{
- p = 0;
-}
-
-} // namespace gs_detail
-
-
-//
-// generic_shared
-//
-// An enhanced relative of scoped_ptr with reference counted copy semantics.
-// The object pointed to is deleted when the last generic_shared pointing to it
-// is destroyed or reset.
-//
-
-template<class T> class generic_shared
-{
-private:
-
- // Borland 5.5.1 specific workaround
- typedef generic_shared<T> this_type;
-
-public:
-
- typedef typename boost::generic_pointer_traits<T>::value_type element_type;
- typedef typename boost::generic_pointer_traits<T>::value_type value_type;
- typedef T pointer;
- typedef typename boost::generic_pointer_traits<T>::reference reference;
- typedef generic_weak<T> weak_type;
-
- template<typename ValueType>
- struct rebind
- {
- typedef generic_shared<typename rebind_generic_pointer<pointer, ValueType>::other > other;
- };
-
- generic_shared(): px(), pn()
- {
- }
-
- template<class Y>
- explicit generic_shared( Y p ): px( p ), pn( p ) // Y must be complete
- {
- boost::gs_detail::sp_enable_shared_from_this( this, &p, get_plain_old_pointer(p) );
- }
-
- //
- // Requirements: D's copy constructor must not throw
- //
- // generic_shared will release p by calling d(p)
- //
-
- template<class Y, class D> generic_shared(Y p, D d): px(p), pn(p, d)
- {
- boost::gs_detail::sp_enable_shared_from_this( this, &p, get_plain_old_pointer(p) );
- }
-
- // As above, but with allocator. A's copy constructor shall not throw.
-
- template<class Y, class D, class A> generic_shared( Y p, D d, A a ): px( p ), pn( p, d, a )
- {
- boost::gs_detail::sp_enable_shared_from_this( this, &p, get_plain_old_pointer(p) );
- }
-
-// generated copy constructor, destructor are fine
-
- template<class Y>
- explicit generic_shared(generic_weak<Y> const & r): pn(r.pn) // may throw
- {
- // it is now safe to copy r.px, as pn(r.pn) did not throw
- px = r.px;
- }
-
- template<class Y>
- generic_shared( generic_weak<Y> const & r, boost::detail::sp_nothrow_tag ): px( 0 ), pn( r.pn, boost::detail::sp_nothrow_tag() ) // never throws
- {
- if( !pn.empty() )
- {
- px = r.px;
- }
- }
-
- template<class Y>
-#if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
-
- generic_shared( generic_shared<Y> const & r, typename gs_detail::sp_enable_if_convertible<Y,T>::type = detail::sp_empty() )
-
-#else
-
- generic_shared( generic_shared<Y> const & r )
-
-#endif
- : px( r.px ), pn( r.pn ) // never throws
- {
- }
-
- // aliasing
- template< class Y, class Z >
- generic_shared( generic_shared<Y> const & r, Z p ): px( p ), pn( r.pn ) // never throws
- {
- }
-
- template<class Y>
- generic_shared(generic_shared<Y> const & r, boost::gs_detail::static_cast_tag):
- px(static_pointer_cast(r.px, boost::mpl::identity<value_type>())),
- pn(r.pn)
- {
- }
-
- template<class Y>
- generic_shared(generic_shared<Y> const & r, boost::gs_detail::const_cast_tag):
- px(const_pointer_cast(r.px, boost::mpl::identity<value_type>())),
- pn(r.pn)
- {
- }
-
- template<class Y>
- generic_shared(generic_shared<Y> const & r, boost::gs_detail::dynamic_cast_tag):
- px(dynamic_pointer_cast(r.px, boost::mpl::identity<value_type>())),
- pn(r.pn)
- {
- if(get_plain_old_pointer(px) == 0) // need to allocate new counter -- the cast failed
- {
- pn = boost::detail::shared_count();
- }
- }
-
-#ifndef BOOST_NO_AUTO_PTR
-
- template<class Y>
- explicit generic_shared(std::auto_ptr<Y> & r): px(r.get()), pn()
- {
- Y * tmp = r.get();
- pn = boost::detail::shared_count(r);
- boost::gs_detail::sp_enable_shared_from_this( this, &tmp, get_plain_old_pointer(tmp) );
- }
-
-#if !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
-
- template<class Ap>
- explicit generic_shared( Ap r, typename boost::gs_detail::sp_enable_if_auto_ptr<Ap, int>::type = 0 ): px( r.get() ), pn()
- {
- typename Ap::element_type * tmp = r.get();
- pn = boost::detail::shared_count( r );
- boost::gs_detail::sp_enable_shared_from_this( this, &tmp, get_plain_old_pointer(tmp) );
- }
-
-
-#endif // BOOST_NO_SFINAE, BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-
-#endif // BOOST_NO_AUTO_PTR
-
- // assignment
-
- generic_shared & operator=( generic_shared const & r ) // never throws
- {
- this_type(r).swap(*this);
- return *this;
- }
-
-#if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1400)
-
- template<class Y>
- generic_shared & operator=(generic_shared<Y> const & r) // never throws
- {
- this_type(r).swap(*this);
- return *this;
- }
-
-#endif
-
-#ifndef BOOST_NO_AUTO_PTR
-
- template<class Y>
- generic_shared & operator=( std::auto_ptr<Y> & r )
- {
- this_type(r).swap(*this);
- return *this;
- }
-
-#if !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
-
- template<class Ap>
- typename boost::gs_detail::sp_enable_if_auto_ptr< Ap, generic_shared & >::type operator=( Ap r )
- {
- this_type( r ).swap( *this );
- return *this;
- }
-
-
-#endif // BOOST_NO_SFINAE, BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-
-#endif // BOOST_NO_AUTO_PTR
-
-// Move support
-
-#if defined( BOOST_HAS_RVALUE_REFS )
-
- generic_shared( generic_shared && r ): px( r.px ), pn() // never throws
- {
- pn.swap( r.pn );
- gs_detail::set_plain_pointer_to_null(r.px);
- }
-
- template<class Y>
-#if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
-
- generic_shared( generic_shared<Y> && r, typename gs_detail::sp_enable_if_convertible<Y,T>::type = detail::sp_empty() )
-
-#else
-
- generic_shared( generic_shared<Y> && r )
-
-#endif
- : px( r.px ), pn() // never throws
- {
- pn.swap( r.pn );
- gs_detail::set_plain_pointer_to_null(r.px);
- }
-
- generic_shared & operator=( generic_shared && r ) // never throws
- {
- this_type( std::move( r ) ).swap( *this );
- return *this;
- }
-
- template<class Y>
- generic_shared & operator=( generic_shared<Y> && r ) // never throws
- {
- this_type( std::move( r ) ).swap( *this );
- return *this;
- }
-
-#endif
-
- void reset() // never throws in 1.30+
- {
- this_type().swap(*this);
- }
-
- template<class Y> void reset(Y p) // Y must be complete
- {
- this_type(p).swap(*this);
- }
-
- template<class Y, class D> void reset( Y p, D d )
- {
- this_type( p, d ).swap( *this );
- }
-
- template<class Y, class D, class A> void reset( Y p, D d, A a )
- {
- this_type( p, d, a ).swap( *this );
- }
-
- template<class Y> void reset( generic_shared<Y> const & r, T p )
- {
- this_type( r, p ).swap( *this );
- }
-
- reference operator* () const // never throws
- {
- BOOST_ASSERT(get_plain_old_pointer(px));
- return *px;
- }
-
- pointer operator-> () const // never throws
- {
- BOOST_ASSERT(get_plain_old_pointer(px));
- return px;
- }
-
- pointer get() const // never throws
- {
- return px;
- }
-
-// implicit conversion to "bool"
-#if 0
-#include <boost/smart_ptr/detail/generic_operator_bool.hpp>
-#else
-// This header intentionally has no include guards.
-//
-// Copyright (c) 2001-2009 Peter Dimov
-//
-// Distributed under the Boost Software License, Version 1.0.
-// See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt
-
-#if ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, < 0x570) ) || defined(__CINT__)
-
- operator bool () const
- {
- return get_plain_old_pointer(px) != 0;
- }
-
-#elif defined( _MANAGED )
-
- static void unspecified_bool( this_type*** )
- {
- }
-
- typedef void (*unspecified_bool_type)( this_type*** );
-
- operator unspecified_bool_type() const // never throws
- {
- return get_plain_old_pointer(px) == 0 ? 0: unspecified_bool;
- }
-
-#elif \
- ( defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, < 0x3200) ) || \
- ( defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 304) ) || \
- ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590) )
-
- typedef T (this_type::*unspecified_bool_type)() const;
-
- operator unspecified_bool_type() const // never throws
- {
- return get_plain_old_pointer(px) == 0 ? 0: &this_type::get;
- }
-
-#else
-
- typedef T this_type::*unspecified_bool_type;
-
- operator unspecified_bool_type() const // never throws
- {
- return get_plain_old_pointer(px) == 0 ? 0: &this_type::px;
- }
-
-#endif
-
- // operator! is redundant, but some compilers need it
- bool operator! () const // never throws
- {
- return get_plain_old_pointer(px) == 0;
- }
-#endif // end implicit conversion to "bool" support
-
- bool unique() const // never throws
- {
- return pn.unique();
- }
-
- long use_count() const // never throws
- {
- return pn.use_count();
- }
-
- void swap(generic_shared<T> & other) // never throws
- {
- std::swap(px, other.px);
- pn.swap(other.pn);
- }
-
- template<class Y> bool _internal_less(generic_shared<Y> const & rhs) const
- {
- return pn < rhs.pn;
- }
-
- void * _internal_get_deleter( detail::sp_typeinfo const & ti ) const
- {
- return pn.get_deleter( ti );
- }
-
- bool _internal_equiv( generic_shared const & r ) const
- {
- return px == r.px && pn == r.pn;
- }
-
-// Tasteless as this may seem, making all members public allows member templates
-// to work in the absence of member template friends. (Matthew Langston)
-
-#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
-
-private:
-
- template<class Y> friend class generic_shared;
- template<class Y> friend class generic_weak;
-
-
-#endif
-
- T px; // contained pointer
- boost::detail::shared_count pn; // reference counter
-
-}; // generic_shared
-
-template<class T, class U> inline bool operator==(generic_shared<T> const & a, generic_shared<U> const & b)
-{
- return a.get() == b.get();
-}
-
-template<class T, class U> inline bool operator!=(generic_shared<T> const & a, generic_shared<U> const & b)
-{
- return a.get() != b.get();
-}
-
-#if __GNUC__ == 2 && __GNUC_MINOR__ <= 96
-
-// Resolve the ambiguity between our op!= and the one in rel_ops
-
-template<class T> inline bool operator!=(generic_shared<T> const & a, generic_shared<T> const & b)
-{
- return a.get() != b.get();
-}
-
-#endif
-
-template<class T, class U> inline bool operator<(generic_shared<T> const & a, generic_shared<U> const & b)
-{
- return a._internal_less(b);
-}
-
-template<class T> inline void swap(generic_shared<T> & a, generic_shared<T> & b)
-{
- a.swap(b);
-}
-
-template<typename ToValueType, typename U>
-typename generic_shared<U>::template rebind<ToValueType>::other static_pointer_cast(generic_shared<U> const & r,
- boost::mpl::identity<ToValueType> = boost::mpl::identity<ToValueType>())
-{
- typedef typename generic_shared<U>::template rebind<ToValueType>::other result_type;
- return result_type(r, boost::gs_detail::static_cast_tag());
-}
-
-template<typename ToValueType, typename U>
-typename generic_shared<U>::template rebind<ToValueType>::other const_pointer_cast(generic_shared<U> const & r,
- boost::mpl::identity<ToValueType> = boost::mpl::identity<ToValueType>())
-{
- typedef typename generic_shared<U>::template rebind<ToValueType>::other result_type;
- return result_type(r, boost::gs_detail::const_cast_tag());
-}
-
-template<typename ToValueType, typename U>
-typename generic_shared<U>::template rebind<ToValueType>::other dynamic_pointer_cast(generic_shared<U> const & r,
- boost::mpl::identity<ToValueType> = boost::mpl::identity<ToValueType>())
-{
- typedef typename generic_shared<U>::template rebind<ToValueType>::other result_type;
- return result_type(r, boost::gs_detail::dynamic_cast_tag());
-}
-
-// get_pointer() enables boost::mem_fn to recognize generic_shared
-template<class T> inline T get_pointer(generic_shared<T> const & p)
-{
- return p.get();
-}
-
-// operator<<
-
-#if !defined(BOOST_NO_IOSTREAM)
-
-#if defined(BOOST_NO_TEMPLATED_IOSTREAMS) || ( defined(__GNUC__) && (__GNUC__ < 3) )
-
-template<class Y> std::ostream & operator<< (std::ostream & os, generic_shared<Y> const & p)
-{
- os << p.get();
- return os;
-}
-
-#else
-
-// in STLport's no-iostreams mode no iostream symbols can be used
-#ifndef _STLP_NO_IOSTREAMS
-
-# if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300 && __SGI_STL_PORT)
-// MSVC6 has problems finding std::basic_ostream through the using declaration in namespace _STL
-using std::basic_ostream;
-template<class E, class T, class Y> basic_ostream<E, T> & operator<< (basic_ostream<E, T> & os, generic_shared<Y> const & p)
-# else
-template<class E, class T, class Y> std::basic_ostream<E, T> & operator<< (std::basic_ostream<E, T> & os, generic_shared<Y> const & p)
-# endif
-{
- os << p.get();
- return os;
-}
-
-#endif // _STLP_NO_IOSTREAMS
-
-#endif // __GNUC__ < 3
-
-#endif // !defined(BOOST_NO_IOSTREAM)
-
-// get_deleter
-
-#if ( defined(__GNUC__) && BOOST_WORKAROUND(__GNUC__, < 3) ) || \
- ( defined(__EDG_VERSION__) && BOOST_WORKAROUND(__EDG_VERSION__, <= 238) ) || \
- ( defined(__HP_aCC) && BOOST_WORKAROUND(__HP_aCC, <= 33500) )
-
-// g++ 2.9x doesn't allow static_cast<X const *>(void *)
-// apparently EDG 2.38 and HP aCC A.03.35 also don't accept it
-
-template<class D, class T> D * get_deleter(generic_shared<T> const & p)
-{
- void const * q = p._internal_get_deleter(BOOST_SP_TYPEID(D));
- return const_cast<D *>(static_cast<D const *>(q));
-}
-
-#else
-
-template<class D, class T> D * get_deleter(generic_shared<T> const & p)
-{
- return static_cast<D *>(p._internal_get_deleter(BOOST_SP_TYPEID(D)));
-}
-
-#endif
-
-// atomic access
-
-#if !defined(BOOST_SP_NO_ATOMIC_ACCESS)
-
-template<class T> inline bool atomic_is_lock_free( generic_shared<T> const * /*p*/ )
-{
- return false;
-}
-
-template<class T> generic_shared<T> atomic_load( generic_shared<T> const * p )
-{
- boost::detail::spinlock_pool<2>::scoped_lock lock( p );
- return *p;
-}
-
-template<class T> inline generic_shared<T> atomic_load_explicit( generic_shared<T> const * p, memory_order /*mo*/ )
-{
- return atomic_load( p );
-}
-
-template<class T> void atomic_store( generic_shared<T> * p, generic_shared<T> r )
-{
- boost::detail::spinlock_pool<2>::scoped_lock lock( p );
- p->swap( r );
-}
-
-template<class T> inline void atomic_store_explicit( generic_shared<T> * p, generic_shared<T> r, memory_order /*mo*/ )
-{
- atomic_store( p, r ); // std::move( r )
-}
-
-template<class T> generic_shared<T> atomic_exchange( generic_shared<T> * p, generic_shared<T> r )
-{
- boost::detail::spinlock & sp = boost::detail::spinlock_pool<2>::spinlock_for( p );
-
- sp.lock();
- p->swap( r );
- sp.unlock();
-
- return r; // return std::move( r )
-}
-
-template<class T> generic_shared<T> atomic_exchange_explicit( generic_shared<T> * p, generic_shared<T> r, memory_order /*mo*/ )
-{
- return atomic_exchange( p, r ); // std::move( r )
-}
-
-template<class T> bool atomic_compare_exchange( generic_shared<T> * p, generic_shared<T> * v, generic_shared<T> w )
-{
- boost::detail::spinlock & sp = boost::detail::spinlock_pool<2>::spinlock_for( p );
-
- sp.lock();
-
- if( p->_internal_equiv( *v ) )
- {
- p->swap( w );
-
- sp.unlock();
-
- return true;
- }
- else
- {
- generic_shared<T> tmp( *p );
-
- sp.unlock();
-
- tmp.swap( *v );
- return false;
- }
-}
-
-template<class T> inline bool atomic_compare_exchange_explicit( generic_shared<T> * p, generic_shared<T> * v, generic_shared<T> w, memory_order /*success*/, memory_order /*failure*/ )
-{
- return atomic_compare_exchange( p, v, w ); // std::move( w )
-}
-
-#endif
-
-} // namespace boost
-
-#ifdef BOOST_MSVC
-# pragma warning(pop)
-#endif
-
-#endif // #if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES)
-
-#endif // #ifndef BOOST_SMART_PTR_SHARED_HPP_INCLUDED

Deleted: sandbox/fmhess/boost/smart_ptr/generic_weak.hpp
==============================================================================
--- sandbox/fmhess/boost/smart_ptr/generic_weak.hpp 2009-07-22 11:46:35 EDT (Wed, 22 Jul 2009)
+++ (empty file)
@@ -1,233 +0,0 @@
-#ifndef BOOST_SMART_PTR_GENERIC_WEAK_HPP_INCLUDED
-#define BOOST_SMART_PTR_GENERIC_WEAK_HPP_INCLUDED
-
-//
-// generic_weak.hpp
-//
-// Copyright (c) 2001, 2002, 2003 Peter Dimov
-// Copyright (c) 2009 Frank Mori Hess
-//
-// Distributed under the Boost Software License, Version 1.0. (See
-// accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-// See http://www.boost.org/libs/smart_ptr/generic_weak.htm for documentation.
-//
-
-#include <memory> // boost.TR1 include order fix
-#include <boost/smart_ptr/detail/shared_count.hpp>
-#include <boost/smart_ptr/generic_shared.hpp>
-
-#ifdef BOOST_MSVC // moved here to work around VC++ compiler crash
-# pragma warning(push)
-# pragma warning(disable:4284) // odd return type for operator->
-#endif
-
-namespace boost
-{
-
-template<class T> class generic_weak
-{
-private:
-
- // Borland 5.5.1 specific workarounds
- typedef generic_weak<T> this_type;
-
-public:
-
- typedef typename generic_pointer_traits<T>::value_type element_type;
- typedef typename generic_pointer_traits<T>::value_type value_type;
- typedef generic_shared<T> shared_type;
-
- generic_weak(): px(), pn() // never throws in 1.30+
- {
- }
-
-// generated copy constructor, assignment, destructor are fine
-
-
-//
-// The "obvious" converting constructor implementation:
-//
-// template<class Y>
-// generic_weak(generic_weak<Y> const & r): px(r.px), pn(r.pn) // never throws
-// {
-// }
-//
-// has a serious problem.
-//
-// r.px may already have been invalidated. The px(r.px)
-// conversion may require access to *r.px (virtual inheritance).
-//
-// It is not possible to avoid spurious access violations since
-// in multithreaded programs r.px may be invalidated at any point.
-//
-
- template<class Y>
-#if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
-
- generic_weak( generic_weak<Y> const & r, typename gs_detail::sp_enable_if_convertible<Y,T>::type = detail::sp_empty() )
-
-#else
-
- generic_weak( generic_weak<Y> const & r )
-
-#endif
- : px(r.lock().get()), pn(r.pn) // never throws
- {
- }
-
-#if defined( BOOST_HAS_RVALUE_REFS )
-
- template<class Y>
-#if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
-
- generic_weak( generic_weak<Y> && r, typename gs_detail::sp_enable_if_convertible<Y,T>::type = detail::sp_empty() )
-
-#else
-
- generic_weak( generic_weak<Y> && r )
-
-#endif
- : px(r.lock().get()), pn(std::move(r.pn)) // never throws
- {
- gs_detail::set_plain_pointer_to_null(r.px);
- }
-
- // for better efficiency in the T == Y case
- generic_weak( generic_weak && r ): px( r.px ), pn(std::move(r.pn)) // never throws
- {
- gs_detail::set_plain_pointer_to_null(r.px);
- }
-
- // for better efficiency in the T == Y case
- generic_weak & operator=( generic_weak && r ) // never throws
- {
- this_type( std::move( r ) ).swap( *this );
- return *this;
- }
-
-
-#endif
-
- template<class Y>
-#if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
-
- generic_weak( generic_shared<Y> const & r, typename gs_detail::sp_enable_if_convertible<Y,T>::type = detail::sp_empty() )
-
-#else
-
- generic_weak( generic_shared<Y> const & r )
-
-#endif
- : px( r.px ), pn( r.pn ) // never throws
- {
- }
-
-#if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1300)
-
- template<class Y>
- generic_weak & operator=(generic_weak<Y> const & r) // never throws
- {
- px = r.lock().get();
- pn = r.pn;
- return *this;
- }
-
-#if defined( BOOST_HAS_RVALUE_REFS )
-
- template<class Y>
- generic_weak & operator=(generic_weak<Y> && r)
- {
- this_type( std::move( r ) ).swap( *this );
- return *this;
- }
-
-#endif
-
- template<class Y>
- generic_weak & operator=(generic_shared<Y> const & r) // never throws
- {
- px = r.px;
- pn = r.pn;
- return *this;
- }
-
-#endif
-
- generic_shared<T> lock() const // never throws
- {
- return generic_shared<T>( *this, boost::detail::sp_nothrow_tag() );
- }
-
- long use_count() const // never throws
- {
- return pn.use_count();
- }
-
- bool expired() const // never throws
- {
- return pn.use_count() == 0;
- }
-
- bool _empty() const // extension, not in std::weak_ptr
- {
- return pn.empty();
- }
-
- void reset() // never throws in 1.30+
- {
- this_type().swap(*this);
- }
-
- void swap(this_type & other) // never throws
- {
- std::swap(px, other.px);
- pn.swap(other.pn);
- }
-
- void _internal_assign(T px2, boost::detail::shared_count const & pn2)
- {
- px = px2;
- pn = pn2;
- }
-
- template<class Y> bool _internal_less(generic_weak<Y> const & rhs) const
- {
- return pn < rhs.pn;
- }
-
-// Tasteless as this may seem, making all members public allows member templates
-// to work in the absence of member template friends. (Matthew Langston)
-
-#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
-
-private:
-
- template<class Y> friend class generic_weak;
- template<class Y> friend class generic_shared;
-
-#endif
-
- T px; // contained pointer
- boost::detail::weak_count pn; // reference counter
-
-}; // generic_weak
-
-template<class T, class U> inline bool operator<(generic_weak<T> const & a, generic_weak<U> const & b)
-{
- return a._internal_less(b);
-}
-
-template<class T> void swap(generic_weak<T> & a, generic_weak<T> & b)
-{
- a.swap(b);
-}
-
-} // namespace boost
-
-#ifdef BOOST_MSVC
-# pragma warning(pop)
-#endif
-
-#endif // #ifndef BOOST_SMART_PTR_GENERIC_WEAK_HPP_INCLUDED

Modified: sandbox/fmhess/boost/smart_ptr/shared_ptr.hpp
==============================================================================
--- sandbox/fmhess/boost/smart_ptr/shared_ptr.hpp (original)
+++ sandbox/fmhess/boost/smart_ptr/shared_ptr.hpp 2009-07-22 11:46:35 EDT (Wed, 22 Jul 2009)
@@ -1,8 +1,8 @@
 #ifndef BOOST_SMART_PTR_SHARED_PTR_HPP_INCLUDED
 #define BOOST_SMART_PTR_SHARED_PTR_HPP_INCLUDED
 
-// Implementation of shared_ptr as wrapper around generic_shared.
-// Written primarily to help test generic_shared using unmodified
+// Implementation of shared_ptr as wrapper around generic_ptr::shared.
+// Written primarily to help test generic_ptr::shared using unmodified
 // shared_ptr tests.
 
 // Copyright (c) 2009 Frank Mori Hess
@@ -11,7 +11,7 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#include <boost/smart_ptr/generic_shared.hpp>
+#include <boost/generic_ptr/shared.hpp>
 
 namespace boost
 {
@@ -25,7 +25,7 @@
 
                 template< class X, class Y, class T > inline void sp_enable_shared_from_this( boost::shared_ptr<X> const * ppx, Y const * py, boost::enable_shared_from_this< T > const * pe )
                 {
- gs_detail::sp_enable_shared_from_this(static_cast<generic_shared<X*> const *>(ppx), &py, pe);
+ generic_ptr::detail::sp_enable_shared_from_this(static_cast<generic_ptr::shared<X*> const *>(ppx), &py, pe);
                 }
 
                 #ifdef _MANAGED
@@ -51,9 +51,9 @@
         }
 
         template<typename T>
- class shared_ptr: public generic_shared<T*>
+ class shared_ptr: public generic_ptr::shared<T*>
         {
- typedef generic_shared<T*> base_type;
+ typedef generic_ptr::shared<T*> base_type;
         public:
                 shared_ptr(const base_type &base): base_type(base)
                 {}
@@ -69,26 +69,26 @@
                 {}
     template<class Y>
 #if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
- shared_ptr( shared_ptr<Y> const & r, typename gs_detail::sp_enable_if_convertible<Y*,T*>::type = detail::sp_empty() )
+ shared_ptr( shared_ptr<Y> const & r, typename generic_ptr::detail::sp_enable_if_convertible<Y*,T*>::type = detail::sp_empty() )
 #else
                 shared_ptr( shared_ptr<Y> const & r )
 #endif
- : base_type(static_cast<generic_shared<Y*> const &>(r))
+ : base_type(static_cast<generic_ptr::shared<Y*> const &>(r))
                 {}
                 template<typename Y>
- shared_ptr(shared_ptr<Y> const & r, T *p): base_type(static_cast<const generic_shared<Y*> &>(r), p)
+ shared_ptr(shared_ptr<Y> const & r, T *p): base_type(static_cast<const generic_ptr::shared<Y*> &>(r), p)
                 {}
                 template<typename Y>
                 explicit shared_ptr(std::auto_ptr<Y> & r): base_type(r)
                 {}
 #if !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
                 template<class Ap>
- explicit shared_ptr( Ap r, typename boost::gs_detail::sp_enable_if_auto_ptr<Ap, int>::type = 0 ):
+ explicit shared_ptr( Ap r, typename generic_ptr::detail::sp_enable_if_auto_ptr<Ap, int>::type = 0 ):
                         base_type(r)
                 {}
 #endif // BOOST_NO_SFINAE, BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
                 template<class Y>
- explicit shared_ptr(weak_ptr<Y> const & r): base_type(static_cast<generic_weak<Y*> const &>(r))
+ explicit shared_ptr(weak_ptr<Y> const & r): base_type(static_cast<generic_ptr::weak<Y*> const &>(r))
                 {}
 
                 template<typename Y>
@@ -98,7 +98,7 @@
                 }
 #if !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
                 template<typename Ap>
- typename boost::gs_detail::sp_enable_if_auto_ptr< Ap, shared_ptr & >::type operator=( Ap r )
+ typename generic_ptr::detail::sp_enable_if_auto_ptr< Ap, shared_ptr & >::type operator=( Ap r )
                 {
                         return static_cast<shared_ptr&>(static_cast<base_type&>(*this) = r);
                 }
@@ -111,7 +111,7 @@
                 template<class Y>
                 shared_ptr & operator=(shared_ptr<Y> const & r) // never throws
                 {
- return static_cast<shared_ptr&>(static_cast<base_type&>(*this) = static_cast<const generic_shared<Y*> &>(r));
+ return static_cast<shared_ptr&>(static_cast<base_type&>(*this) = static_cast<const generic_ptr::shared<Y*> &>(r));
                 }
 #endif
                 void reset() { base_type::reset(); }
@@ -129,24 +129,78 @@
                 }
                 template<typename Y> void reset( shared_ptr<Y> const & r, T *p )
                 {
- base_type::reset(static_cast<generic_shared<Y*> const &>(r), p);
+ base_type::reset(static_cast<generic_ptr::shared<Y*> const &>(r), p);
                 }
         };
 
         template<class T, class U> shared_ptr<T> static_pointer_cast(shared_ptr<U> const & r)
         {
- return static_pointer_cast<T>(static_cast<generic_shared<U*> const &>(r));
+ return generic_ptr::static_pointer_cast<T>(r);
         }
 
         template<class T, class U> shared_ptr<T> const_pointer_cast(shared_ptr<U> const & r)
         {
- return const_pointer_cast<T>(static_cast<generic_shared<U*> const &>(r));
+ return generic_ptr::const_pointer_cast<T>(r);
         }
 
         template<class T, class U> shared_ptr<T> dynamic_pointer_cast(shared_ptr<U> const & r)
         {
- return dynamic_pointer_cast<T>(static_cast<generic_shared<U*> const &>(r));
+ return generic_ptr::dynamic_pointer_cast<T>(r);
         }
-}
+
+ template<typename T>
+ T* get_pointer(const shared_ptr<T> &sp)
+ {
+ return get_pointer(static_cast<const generic_ptr::shared<T*> &>(sp));
+ }
+ template<class D, class T> D * get_deleter(shared_ptr<T> const & p)
+ {
+ return generic_ptr::get_deleter<D>(p);
+ }
+
+#if !defined(BOOST_SP_NO_ATOMIC_ACCESS)
+ template<class T> inline bool atomic_is_lock_free( shared_ptr<T> const * p )
+ {
+ return generic_ptr::atomic_is_lock_free(p);
+ }
+ template<class T> shared_ptr<T> atomic_load( shared_ptr<T> const * p )
+ {
+ return generic_ptr::atomic_load(p);
+ }
+ template<class T> inline shared_ptr<T> atomic_load_explicit( shared_ptr<T> const * p, memory_order mo )
+ {
+ return generic_ptr::atomic_load_explicit( p, mo );
+ }
+ template<class T> void atomic_store( shared_ptr<T> * p, shared_ptr<T> r )
+ {
+ generic_ptr::atomic_store(p, r);
+ }
+ template<class T> inline void atomic_store_explicit( shared_ptr<T> * p, shared_ptr<T> r, memory_order mo )
+ {
+ generic_ptr::atomic_store_explicit(p, r, mo);
+ }
+ template<class T> shared_ptr<T> atomic_exchange( shared_ptr<T> * p, shared_ptr<T> r )
+ {
+ return generic_ptr::atomic_exchange(p, r);
+ }
+
+ template<class T> shared_ptr<T> atomic_exchange_explicit( shared_ptr<T> * p, shared_ptr<T> r, memory_order mo )
+ {
+ return generic_ptr::atomic_exchange_explicit( p, r, mo );
+ }
+
+ template<class T> bool atomic_compare_exchange( shared_ptr<T> * p, shared_ptr<T> * v, shared_ptr<T> w )
+ {
+ return generic_ptr::atomic_compare_exchange(p, v, w);
+ }
+
+ template<class T> inline bool atomic_compare_exchange_explicit( shared_ptr<T> * p, shared_ptr<T> * v, shared_ptr<T> w, memory_order success, memory_order failure )
+ {
+ return generic_ptr::atomic_compare_exchange_explicit( p, v, w, success, failure );
+ }
+
+#endif
+
+} // namespace boost
 
 #endif // #ifndef BOOST_SMART_PTR_SHARED_PTR_HPP_INCLUDED

Modified: sandbox/fmhess/boost/smart_ptr/weak_ptr.hpp
==============================================================================
--- sandbox/fmhess/boost/smart_ptr/weak_ptr.hpp (original)
+++ sandbox/fmhess/boost/smart_ptr/weak_ptr.hpp 2009-07-22 11:46:35 EDT (Wed, 22 Jul 2009)
@@ -1,8 +1,8 @@
 #ifndef BOOST_SMART_PTR_WEAK_PTR_HPP_INCLUDED
 #define BOOST_SMART_PTR_WEAK_PTR_HPP_INCLUDED
 
-// Implementation of weak_ptr as wrapper around generic_weak.
-// Written primarily to help test generic_shared/generic_weak using unmodified
+// Implementation of weak_ptr as wrapper around generic_ptr::weak.
+// Written primarily to help test generic_ptr::shared/generic_ptr::weak using unmodified
 // shared_ptr tests.
 
 // Copyright (c) 2009 Frank Mori Hess
@@ -11,15 +11,15 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#include <boost/smart_ptr/generic_weak.hpp>
+#include <boost/generic_ptr/weak.hpp>
 #include <boost/smart_ptr/shared_ptr.hpp>
 
 namespace boost
 {
         template<typename T>
- class weak_ptr: public generic_weak<T*>
+ class weak_ptr: public generic_ptr::weak<T*>
         {
- typedef generic_weak<T*> base_type;
+ typedef generic_ptr::weak<T*> base_type;
         public:
                 weak_ptr() {}
                 weak_ptr(base_type const & b): base_type(b) {}
@@ -29,7 +29,7 @@
 #else
                 weak_ptr( weak_ptr<Y> const & r )
 #endif
- :base_type(static_cast<generic_weak<Y*> const &>(r))
+ :base_type(static_cast<generic_ptr::weak<Y*> const &>(r))
                 {}
     template<class Y>
 #if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
@@ -37,7 +37,7 @@
 #else
                 weak_ptr( shared_ptr<Y> const & r )
 #endif
- :base_type(static_cast<generic_shared<Y*> const &>(r))
+ :base_type(static_cast<generic_ptr::shared<Y*> const &>(r))
                 {}
                 shared_ptr<T> lock() const
                 {


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk