Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r71484 - in sandbox/mm_ptr: boost boost/detail libs/smart_ptr/example
From: phil_at_[hidden]
Date: 2011-04-25 13:16:10


Author: pbouchard
Date: 2011-04-25 13:16:09 EDT (Mon, 25 Apr 2011)
New Revision: 71484
URL: http://svn.boost.org/trac/boost/changeset/71484

Log:
* Using atomic_count as the set counter
* Cleaned up files

Removed:
   sandbox/mm_ptr/boost/detail/sh_owned_base.hpp
   sandbox/mm_ptr/boost/detail/sh_owned_base_gcc_x86.hpp
   sandbox/mm_ptr/boost/detail/sh_owned_base_nt.hpp
   sandbox/mm_ptr/boost/detail/sh_owned_impl.h
Text files modified:
   sandbox/mm_ptr/boost/detail/mm_ptr_base.hpp | 6 +++---
   sandbox/mm_ptr/boost/mm_ptr.hpp | 37 ++++++++++++++++++++-----------------
   sandbox/mm_ptr/libs/smart_ptr/example/Makefile | 4 ++--
   3 files changed, 25 insertions(+), 22 deletions(-)

Modified: sandbox/mm_ptr/boost/detail/mm_ptr_base.hpp
==============================================================================
--- sandbox/mm_ptr/boost/detail/mm_ptr_base.hpp (original)
+++ sandbox/mm_ptr/boost/detail/mm_ptr_base.hpp 2011-04-25 13:16:09 EDT (Mon, 25 Apr 2011)
@@ -20,7 +20,7 @@
 
 
 #include <boost/detail/sh_utility.h>
-#include <boost/detail/sh_owned_base.hpp>
+#include <boost/detail/sh_mm_base.hpp>
 
 
 namespace boost
@@ -175,9 +175,9 @@
         }
 
         protected:
- detail::sh::owned_base * header() const
+ detail::sh::mm_base * header() const
                 {
- detail::sh::owned_base * p = (mm<value_type> *) (typename mm<value_type>::roofof) static_cast<value_type *>(rootof<is_polymorphic<value_type>::value>::get(po_));
+ detail::sh::mm_base * p = (mm<value_type> *) (typename mm<value_type>::roofof) static_cast<value_type *>(rootof<is_polymorphic<value_type>::value>::get(po_));
                         return p;
                 }
         };

Deleted: sandbox/mm_ptr/boost/detail/sh_owned_base.hpp
==============================================================================
--- sandbox/mm_ptr/boost/detail/sh_owned_base.hpp 2011-04-25 13:16:09 EDT (Mon, 25 Apr 2011)
+++ (empty file)
@@ -1,88 +0,0 @@
-/**
- @file
- Boost sh_owned_base.hpp header file.
-
- @note
- Copyright (c) 2008 Phil Bouchard <phil_at_[hidden]>.
-
- 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/doc/index.html for documentation.
-*/
-
-
-#ifndef BOOST_DETAIL_SP_OWNED_BASE_HPP_INCLUDED
-#define BOOST_DETAIL_SP_OWNED_BASE_HPP_INCLUDED
-
-// Me
-#define BOOST_SP_DISABLE_THREADS
-
-// MS compatible compilers support #pragma once
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-//
-// detail/sh_owned_base.hpp
-//
-// Copyright 2008 Phil Bouchard
-//
-// 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)
-//
-
-#include <boost/config.hpp>
-
-#if defined( BOOST_SP_DISABLE_THREADS )
-
-# include <boost/detail/sh_owned_base_nt.hpp>
-
-#elif defined( BOOST_SP_USE_PTHREADS )
-
-# include <boost/detail/sh_owned_base_pt.hpp>
-
-#elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) )
-
-# include <boost/detail/sh_owned_base_gcc_x86.hpp>
-
-//~ #elif defined( __MWERKS__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) )
-
-//~ # include <boost/detail/sh_owned_base_cw_x86.hpp>
-
-#elif defined( __GNUC__ ) && defined( __ia64__ ) && !defined( __INTEL_COMPILER )
-
-# include <boost/detail/sh_owned_base_gcc_ia64.hpp>
-
-#elif defined( __MWERKS__ ) && defined( __POWERPC__ )
-
-# include <boost/detail/sh_owned_base_cw_ppc.hpp>
-
-#elif defined( __GNUC__ ) && ( defined( __powerpc__ ) || defined( __ppc__ ) )
-
-# include <boost/detail/sh_owned_base_gcc_ppc.hpp>
-
-#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ )
-
-# include <boost/detail/sh_owned_base_w32.hpp>
-
-#elif !defined( BOOST_HAS_THREADS )
-
-# include <boost/detail/sh_owned_base_nt.hpp>
-
-#elif defined( BOOST_HAS_PTHREADS )
-
-# include <boost/detail/sh_owned_base_pt.hpp>
-
-#else
-
-// Use #define BOOST_DISABLE_THREADS to avoid the error
-# error Unrecognized threading platform
-
-#endif
-
-#endif // #ifndef BOOST_DETAIL_SH_OWNED_BASE_HPP_INCLUDED

Deleted: sandbox/mm_ptr/boost/detail/sh_owned_base_gcc_x86.hpp
==============================================================================
--- sandbox/mm_ptr/boost/detail/sh_owned_base_gcc_x86.hpp 2011-04-25 13:16:09 EDT (Mon, 25 Apr 2011)
+++ (empty file)
@@ -1,159 +0,0 @@
-#ifndef BOOST_DETAIL_SH_OWNED_BASE_GCC_X86_HPP_INCLUDED
-#define BOOST_DETAIL_SH_OWNED_BASE_GCC_X86_HPP_INCLUDED
-
-// MS compatible compilers support #pragma once
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-//
-// detail/sh_owned_base_gcc_x86.hpp - g++ on 486+ or AMD64
-//
-// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
-// Copyright 2004-2005 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)
-//
-//
-// Lock-free algorithm by Alexander Terekhov
-//
-// Thanks to Ben Hitchings for the #weak + (#shared != 0)
-// formulation
-//
-
-#include <boost/detail/sp_owned_base_gcc_x86.hpp>
-
-#include <typeinfo>
-
-namespace boost
-{
-
-namespace detail
-{
-
-namespace sh
-{
-
-inline int atomic_exchange_and_add( int * pw, int dv )
-{
- // int r = *pw;
- // *pw += dv;
- // return r;
-
- int r;
-
- __asm__ __volatile__
- (
- "lock\n\t"
- "xadd %1, %0":
- "=m"( *pw ), "=r"( r ): // outputs (%0, %1)
- "m"( *pw ), "1"( dv ): // inputs (%2, %3 == %1)
- "memory", "cc" // clobbers
- );
-
- return r;
-}
-
-inline void atomic_increment( int * pw )
-{
- //atomic_exchange_and_add( pw, 1 );
-
- __asm__
- (
- "lock\n\t"
- "incl %0":
- "=m"( *pw ): // output (%0)
- "m"( *pw ): // input (%1)
- "cc" // clobbers
- );
-}
-
-inline int atomic_conditional_increment( int * pw )
-{
- // int rv = *pw;
- // if( rv != 0 ) ++*pw;
- // return rv;
-
- int rv, tmp;
-
- __asm__
- (
- "movl %0, %%eax\n\t"
- "0:\n\t"
- "test %%eax, %%eax\n\t"
- "je 1f\n\t"
- "movl %%eax, %2\n\t"
- "incl %2\n\t"
- "lock\n\t"
- "cmpxchgl %2, %0\n\t"
- "jne 0b\n\t"
- "1:":
- "=m"( *pw ), "=&a"( rv ), "=&r"( tmp ): // outputs (%0, %1, %2)
- "m"( *pw ): // input (%3)
- "cc" // clobbers
- );
-
- return rv;
-}
-
-class owned_base : public sp_counted_base
-{
-private:
-
- owned_base( owned_base const & );
- owned_base & operator= ( owned_base const & );
-
- long seg_count_; // #set
- owned_base * po_;
- owned_base ** ppo_;
-
-public:
-
- owned_base(): seg_count_( 1 ), po_( this ), ppo_( po_ )
- {
- }
-
- void add_own_copy()
- {
- atomic_increment( &(*ppo_)->seg_count_ );
- }
-
- bool add_own_lock() // true on success
- {
- return atomic_conditional_increment( &(*ppo_)->seg_count_ ) != 0;
- }
-
- void release() // nothrow
- {
- if( atomic_exchange_and_add( &(*ppo_)->seg_count_, -1 ) == 1 )
- {
- dispose();
- }
- }
-
- long seg_count() const // nothrow
- {
- return static_cast<int const volatile &>( (*ppo_)->seg_count_ );
- }
-
- owned_base * owner() const // nothrow
- {
- return (*ppo_);
- }
-
- void owner(owned_base * p) // nothrow
- {
- (*ppo_) = p;
- }
-};
-
-} // namespace sh
-
-} // namespace detail
-
-} // namespace boost
-
-#endif // #ifndef BOOST_DETAIL_SH_OWNED_BASE_GCC_X86_HPP_INCLUDED

Deleted: sandbox/mm_ptr/boost/detail/sh_owned_base_nt.hpp
==============================================================================
--- sandbox/mm_ptr/boost/detail/sh_owned_base_nt.hpp 2011-04-25 13:16:09 EDT (Mon, 25 Apr 2011)
+++ (empty file)
@@ -1,334 +0,0 @@
-/**
- @file
- Boost detail/sh_owned_base_nt.hpp header file.
-
- @note
- Copyright (c) 2008 Phil Bouchard <phil_at_[hidden]>.
-
- 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/doc/index.html for documentation.
-*/
-
-
-#ifndef BOOST_DETAIL_SH_OWNED_BASE_NT_HPP_INCLUDED
-#define BOOST_DETAIL_SH_OWNED_BASE_NT_HPP_INCLUDED
-
-// MS compatible compilers support #pragma once
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-#include <stack>
-#include <limits>
-
-// Bypassing linkage by default
-#define BOOST_SH_DISABLE_THREADS
-
-#include <boost/thread.hpp>
-#include <boost/thread/tss.hpp>
-#include <boost/pool/pool.hpp>
-#include <boost/pool/pool_alloc.hpp>
-#include <boost/numeric/interval.hpp>
-#include <boost/type_traits/is_array.hpp>
-#include <boost/type_traits/remove_extent.hpp>
-#include <boost/type_traits/has_trivial_destructor.hpp>
-#include <boost/preprocessor/control/expr_if.hpp>
-#include <boost/preprocessor/arithmetic/inc.hpp>
-#include <boost/preprocessor/punctuation/comma_if.hpp>
-#include <boost/preprocessor/repetition/repeat.hpp>
-#include <boost/preprocessor/repetition/repeat_from_to.hpp>
-
-#include <boost/detail/intrusive_list.hpp>
-#include <boost/detail/intrusive_stack.hpp>
-#include <boost/detail/sh_utility.h>
-
-
-namespace boost
-{
-
-namespace detail
-{
-
-namespace sh
-{
-
-
-class mm_header;
-class owned_base;
-
-
-/**
- Allocator wrapper tracking allocations.
-
- Pool where all pointee objects are allocated and tracks memory blocks for later enlisting & marking the @c mm_header the pointee object belongs to.
-*/
-
-struct pool : boost::pool<>
-{
- typedef std::list< numeric::interval<long>, fast_pool_allocator< numeric::interval<long> > > pool_lii; /**< Syntax helper. */
-
-#ifndef BOOST_SH_DISABLE_THREADS
- thread_specific_ptr<pool_lii> plii_; /**< Thread specific list of memory boundaries. */
-#else
- std::auto_ptr<pool_lii> plii_; /**< List of memory boundaries. */
-#endif
-
-
- /**
- Initialization of a pool instance.
- */
-
- pool() : boost::pool<>(1)
- {
- plii_.reset(new pool_lii());
- }
-
-
- /**
- Tracks the memory boundaries where a pointer belongs to. Also gets rid of the boundaries that were allocated before the pointer was allocated.
-
- @param p Pointer that is being tracked.
- @return Pointer to the pointee object where @c p belongs to.
- */
-
- owned_base * top(void * p)
- {
- pool_lii::reverse_iterator i;
-
- for (i = plii_->rbegin(); i != plii_->rend(); i ++)
- if (in((long)(p), * i))
- break;
-
- plii_->erase(i.base(), plii_->end());
-
- return (owned_base *)(plii_->rbegin()->lower());
- }
-
-
- /**
- Pointee object allocator and stacking of the newly allocated memory boundary.
-
- @param s Size of the memory block to allocate.
- @return Address of the newly allocated block.
- */
-
- void * allocate(std::size_t s)
- {
- void * p = ordered_malloc(s);
-
- plii_->push_back(numeric::interval<long>((long) p, long((char *)(p) + s)));
-
- return p;
- }
-
-
- /**
- Pointee object deallocator and removal of the boundaries that were allocated before the pointer was allocated.
-
- @param p Address of the memory block to deallocate.
- @param s Size of the memory block.
- */
-
- void deallocate(void * p, std::size_t s)
- {
- pool_lii::reverse_iterator i;
-
- for (i = plii_->rbegin(); i != plii_->rend(); i ++)
- if (in((long)(p), * i))
- break;
-
- plii_->erase(i.base(), plii_->end());
- ordered_free(p, s);
- }
-};
-
-
-/**
- Root class of all pointee objects.
-*/
-
-class owned_base : public sp_counted_base
-{
-public:
- bool init_; /**< Flag marking initialization of the pointee object to its @c mm_header . */
-
- intrusive_stack ptrs_; /**< Stack of all @c mm_ptr s on the heap that will later need to be initlialized to a specific @c mm_header . */
- intrusive_list inits_; /**< List of all pointee objects that will later need to be initlialized to a specific @c mm_header .*/
-
- intrusive_list::node mm_tag_; /**< Tag used to enlist to @c mm_header::elements_ . */
- intrusive_list::node init_tag_; /**< Tag used to enlist to @c owned_base::inits_ . */
-
-
- owned_base() : init_(false)
- {
- inits_.push_back(& init_tag_);
- }
-
- static pool pool_; /**< Pool where all pointee objects are allocated from. */
-
-protected:
- virtual void dispose() {} /**< dummy */
- virtual void * get_deleter( std::type_info const & ti ) { return 0; } /**< dummy */
-};
-
-
-pool owned_base::pool_;
-
-
-#define TEMPLATE_DECL(z, n, text) BOOST_PP_COMMA_IF(n) typename T ## n
-#define ARGUMENT_DECL(z, n, text) BOOST_PP_COMMA_IF(n) T ## n const & t ## n
-#define PARAMETER_DECL(z, n, text) BOOST_PP_COMMA_IF(n) t ## n
-
-#define CONSTRUCT_OWNED(z, n, text) \
- template <BOOST_PP_REPEAT(n, TEMPLATE_DECL, 0)> \
- text(BOOST_PP_REPEAT(n, ARGUMENT_DECL, 0)) : elem_(BOOST_PP_REPEAT(n, PARAMETER_DECL, 0)) {}
-
-/**
- Object wrapper.
-*/
-
-template <typename T>
- class mm : public owned_base
- {
- typedef T data_type;
-
- T elem_; /**< Pointee object. @note Needs alignas<long>. */
-
- public:
- class roofof;
- friend class roofof;
-
- mm() : elem_()
- {
- }
-
- BOOST_PP_REPEAT_FROM_TO(1, 10, CONSTRUCT_OWNED, mm)
-
-
- /**
- @return Pointee object address.
- */
-
- data_type * element() { return & elem_; }
- operator data_type & () { return * element(); }
- operator data_type const & () const { return * element(); }
-
- virtual ~mm()
- {
- dispose();
- }
-
- public:
- /**
- Cast operator used by @c mm_ptr_common::header() .
- */
-
- class roofof
- {
- mm * p_; /**< Address of the @c mm the element belong to. */
-
- public:
- /**
- Casts from a @c data_type to its parent @c mm object.
-
- @param p Address of a @c data_type member object to cast from.
- */
-
- roofof(data_type * p) : p_(sh::roofof((data_type mm::*)(& mm::elem_), p)) {}
-
-
- /**
- @return Address of the parent @c mm object.
- */
-
- operator mm * () const { return p_; }
- };
-
-
- /**
- Allocates a new @c mm using the pool.
-
- @param s Size of the @c mm .
- @return Pointer of the new memory block.
- */
-
- void * operator new (size_t s)
- {
- return pool_.allocate(s);
- }
-
-
- /**
- Deallocates a @c mm from the pool.
-
- @param p Address of the @c mm to deallocate.
- */
-
- void operator delete (void * p)
- {
- pool_.deallocate(p, sizeof(mm));
- }
- };
-
-
-template <>
- class mm<void> : public owned_base
- {
- typedef void data_type;
-
- long elem_; /**< Pointee placeholder. @note Aligned. */
-
- mm();
-
- public:
- class roofof;
- friend class roofof;
-
- data_type * element() { return & elem_; }
-
- virtual ~mm() {}
- virtual void dispose() {}
-
- virtual void * get_deleter( std::type_info const & ti ) {}
-
- public:
- /**
- Cast operator used by @c mm_ptr_common::header() .
- */
-
- class roofof
- {
- mm * p_; /**< Address of the @c mm the element belong to. */
-
- public:
- /**
- Casts from a @c data_type to its parent @c mm object.
-
- @param p Address of a @c data_type member object to cast from.
- */
-
- roofof(data_type * p) : p_(sh::roofof((long mm::*)(& mm::elem_), static_cast<long *>(p))) {}
-
-
- /**
- @return Address of the parent @c mm object.
- */
-
- operator mm * () const { return p_; }
- };
- };
-
-
-} // namespace sh
-
-} // namespace detail
-
-} // namespace boost
-
-
-#endif // #ifndef BOOST_DETAIL_SH_OWNED_BASE_NT_HPP_INCLUDED

Deleted: sandbox/mm_ptr/boost/detail/sh_owned_impl.h
==============================================================================
--- sandbox/mm_ptr/boost/detail/sh_owned_impl.h 2011-04-25 13:16:09 EDT (Mon, 25 Apr 2011)
+++ (empty file)
@@ -1,231 +0,0 @@
-/**
- @file
- Boost sh_owned_impl.h header file.
-
- @note
- Copyright (c) 2008 Phil Bouchard <phil_at_[hidden]>.
-
- 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/doc/index.html for documentation.
-*/
-
-
-#ifndef BOOST_DETAIL_SH_OWNED_IMPL_HPP_INCLUDED
-#define BOOST_DETAIL_SH_OWNED_IMPL_HPP_INCLUDED
-
-// MS compatible compilers support #pragma once
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-//
-// detail/sh_owned_impl.hpp
-//
-// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
-// Copyright 2008 Philippe Bouchard
-//
-// 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)
-//
-
-#include <boost/config.hpp>
-
-#if defined(BOOST_SP_USE_STD_ALLOCATOR) && defined(BOOST_SP_USE_QUICK_ALLOCATOR)
-# error BOOST_SP_USE_STD_ALLOCATOR and BOOST_SP_USE_QUICK_ALLOCATOR are incompatible.
-#endif
-
-#include <boost/checked_delete.hpp>
-#include <boost/detail/sh_owned_base.hpp>
-
-#if defined(BOOST_SP_USE_QUICK_ALLOCATOR)
-#include <boost/detail/quick_allocator.hpp>
-#endif
-
-#if defined(BOOST_SP_USE_STD_ALLOCATOR)
-#include <memory> // std::allocator
-#endif
-
-#include <typeinfo> // std::type_info in get_deleter
-#include <cstddef> // std::size_t
-
-namespace boost
-{
-
-#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
-
-void sh_scalar_constructor_hook( void * px, std::size_t size, void * pn );
-void sh_scalar_destructor_hook( void * px, std::size_t size, void * pn );
-
-#endif
-
-namespace detail
-{
-
-namespace sh
-{
-
-template<class X> class owned_impl_p: public owned<X>
-{
-private:
-
- owned_impl_p( owned_impl_p const & );
- owned_impl_p & operator= ( owned_impl_p const & );
-
- typedef owned_impl_p<X> this_type;
-
-public:
-
- virtual void dispose() // nothrow
- {
-#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
- boost::scalar_destructor_hook( p_, sizeof(X), this );
-#endif
- }
-
- virtual void * get_deleter( std::type_info const & )
- {
- return 0;
- }
-
-#if defined(BOOST_SP_USE_STD_ALLOCATOR)
-
- void * operator new( std::size_t )
- {
- return std::allocator<this_type>().allocate( 1, static_cast<this_type *>(0) );
- }
-
- void operator delete( void * p )
- {
- std::allocator<this_type>().deallocate( static_cast<this_type *>(p), 1 );
- }
-
-#endif
-
-#if defined(BOOST_SP_USE_QUICK_ALLOCATOR)
-
- void * operator new( std::size_t )
- {
- return quick_allocator<this_type>::alloc();
- }
-
- void operator delete( void * p )
- {
- quick_allocator<this_type>::dealloc( p );
- }
-
-#endif
-};
-
-//
-// Borland's Codeguard trips up over the -Vx- option here:
-//
-#ifdef __CODEGUARD__
-# pragma option push -Vx-
-#endif
-
-template<class P, class D> class owned_impl_pd: public owned<X>
-{
-private:
-
- D d_; // copy constructor must not throw
-
- owned_impl_pd( owned_impl_pd const & );
- owned_impl_pd & operator= ( owned_impl_pd const & );
-
- typedef owned_impl_pd<P, D> this_type;
-
-public:
-
- // pre: d(p) must not throw
-
- owned_impl_pd( D d ): d_(d)
- {
- }
-
- virtual void dispose() // nothrow
- {
- d_( p_ );
- }
-
- virtual void * get_deleter( std::type_info const & ti )
- {
- return ti == typeid(D)? &d_: 0;
- }
-
-#if defined(BOOST_SP_USE_STD_ALLOCATOR)
-
- void * operator new( std::size_t )
- {
- return std::allocator<this_type>().allocate( 1, static_cast<this_type *>(0) );
- }
-
- void operator delete( void * p )
- {
- std::allocator<this_type>().deallocate( static_cast<this_type *>(p), 1 );
- }
-
-#endif
-
-#if defined(BOOST_SP_USE_QUICK_ALLOCATOR)
-
- void * operator new( std::size_t )
- {
- return quick_allocator<this_type>::alloc();
- }
-
- void operator delete( void * p )
- {
- quick_allocator<this_type>::dealloc( p );
- }
-
-#endif
-};
-
-template<class P, class D, class A> class owned_impl_pda: public owned<X>
-{
-private:
-
- D d_; // copy constructor must not throw
- A a_; // copy constructor must not throw
-
- owned_impl_pda( owned_impl_pda const & );
- owned_impl_pda & operator= ( owned_impl_pda const & );
-
- typedef owned_impl_pda<P, D, A> this_type;
-
-public:
-
- // pre: d( p ) must not throw
-
- owned_impl_pda( D d, A a ): d_( d ), a_( a )
- {
- }
-
- virtual void dispose() // nothrow
- {
- d_( p_ );
- }
-
- virtual void * get_deleter( std::type_info const & ti )
- {
- return ti == typeid( D )? &d_: 0;
- }
-};
-
-#ifdef __CODEGUARD__
-# pragma option pop
-#endif
-
-} // namespace sh
-
-} // namespace detail
-
-} // namespace boost
-
-#endif // #ifndef BOOST_DETAIL_SP_OWNED_IMPL_HPP_INCLUDED

Modified: sandbox/mm_ptr/boost/mm_ptr.hpp
==============================================================================
--- sandbox/mm_ptr/boost/mm_ptr.hpp (original)
+++ sandbox/mm_ptr/boost/mm_ptr.hpp 2011-04-25 13:16:09 EDT (Mon, 25 Apr 2011)
@@ -32,6 +32,7 @@
 #include <iostream>
 #include <boost/pool/pool_alloc.hpp>
 #include <boost/type_traits/add_pointer.hpp>
+#include <boost/smart_ptr/detail/atomic_count.hpp>
 
 #include <boost/detail/intrusive_list.hpp>
 #include <boost/detail/intrusive_stack.hpp>
@@ -49,7 +50,7 @@
 {
 
 
-class owned_base;
+class mm_base;
 
 
 /**
@@ -60,8 +61,10 @@
 
 class mm_header
 {
- long count_; /**< Count of the number of pointers from the stack referencing the same @c mm_header .*/
- mutable mm_header * redir_; /**< Redirection in the case of an union multiple sets.*/
+ typedef detail::atomic_count count_type;
+
+ count_type count_; /**< Count of the number of pointers from the stack referencing the same @c mm_header .*/
+ mutable mm_header * redir_; /**< Redirection in the case of an union multiple sets.*/
 
     intrusive_list includes_; /**< List of all sets of an union. */
     intrusive_list elements_; /**< List of all pointee objects belonging to a @c mm_header . */
@@ -96,7 +99,7 @@
         if (-- p->count_ == 0)
         {
                         p->destroy_ = true;
- for (intrusive_list::iterator<owned_base, & owned_base::mm_tag_> i; i = p->elements_.begin(), i != p->elements_.end(); )
+ for (intrusive_list::iterator<mm_base, & mm_base::mm_tag_> i; i = p->elements_.begin(), i != p->elements_.end(); )
                 delete &* i;
                         p->destroy_ = false;
             
@@ -143,7 +146,7 @@
             redir_ = p->redir();
             redir_->includes_.merge(includes_);
             redir_->elements_.merge(elements_);
- redir_->count_ += count_;
+ new (& redir_->count_) count_type(redir_->count_ + count_); /**< Hack */
         }
     }
 
@@ -236,10 +239,10 @@
                 
         mm_ptr() : ps_(0)
         {
- if (! owned_base::pool_.is_from(this))
+ if (! mm_base::pool_.is_from(this))
                 ps_ = new mm_header();
             else
- owned_base::pool_.top(this)->ptrs_.push(& pn_);
+ mm_base::pool_.top(this)->ptrs_.push(& pn_);
         }
 
                 
@@ -252,7 +255,7 @@
         template <typename V>
             mm_ptr(mm<V> * p) : base(p)
             {
- if (! owned_base::pool_.is_from(this))
+ if (! mm_base::pool_.is_from(this))
                 {
                     ps_ = new mm_header();
 
@@ -260,8 +263,8 @@
                 }
                 else
                 {
- owned_base::pool_.top(this)->ptrs_.push(& pn_);
- owned_base::pool_.top(this)->inits_.merge(p->inits_);
+ mm_base::pool_.top(this)->ptrs_.push(& pn_);
+ mm_base::pool_.top(this)->inits_.merge(p->inits_);
                 }
             }
 
@@ -275,10 +278,10 @@
         template <typename V>
             mm_ptr(mm_ptr<V> const & p) : base(p)
             {
- if (! owned_base::pool_.is_from(this))
+ if (! mm_base::pool_.is_from(this))
                     ps_ = new mm_header();
                 else
- owned_base::pool_.top(this)->ptrs_.push(& pn_);
+ mm_base::pool_.top(this)->ptrs_.push(& pn_);
 
                 ps_->redir(p.ps_);
             }
@@ -292,10 +295,10 @@
 
                         mm_ptr(mm_ptr<T> const & p) : base(p)
             {
- if (! owned_base::pool_.is_from(this))
+ if (! mm_base::pool_.is_from(this))
                     ps_ = new mm_header();
                 else
- owned_base::pool_.top(this)->ptrs_.push(& pn_);
+ mm_base::pool_.top(this)->ptrs_.push(& pn_);
                                 
                 ps_->redir(p.ps_);
             }
@@ -376,7 +379,7 @@
         {
             base::reset();
             
- if (! owned_base::pool_.is_from(this))
+ if (! mm_base::pool_.is_from(this))
                 if (ps_->release())
                     if (! d)
                         new (ps_) mm_header();
@@ -394,13 +397,13 @@
                         @param p Pointee object to initialize.
                 */
                 
- void init(owned_base * p)
+ void init(mm_base * p)
         {
             if (p->init_)
                 return;
         
                         // iterate memory blocks
- for (intrusive_list::iterator<owned_base, & owned_base::init_tag_> i = p->inits_.begin(); i != p->inits_.end(); ++ i)
+ for (intrusive_list::iterator<mm_base, & mm_base::init_tag_> i = p->inits_.begin(); i != p->inits_.end(); ++ i)
             {
                 i->init_ = true;
                 ps_->elements()->push_back(& i->mm_tag_);

Modified: sandbox/mm_ptr/libs/smart_ptr/example/Makefile
==============================================================================
--- sandbox/mm_ptr/libs/smart_ptr/example/Makefile (original)
+++ sandbox/mm_ptr/libs/smart_ptr/example/Makefile 2011-04-25 13:16:09 EDT (Mon, 25 Apr 2011)
@@ -1,8 +1,8 @@
 CXX := g++
 CXXFLAGS := -ggdb3
-INCPATH := -I../../..
+INCPATH := -I../../.. -I../../../../../include
 LINK := g++
-LFLAGS :=
+LFLAGS := -L../../../../../lib
 RM := rm
 HEADERS := $(wildcard *.h)
 SOURCES := $(wildcard *.cpp)


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