|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r52196 - in branches/release/boost/ptr_container: . detail
From: nesotto_at_[hidden]
Date: 2009-04-05 15:55:59
Author: nesotto
Date: 2009-04-05 15:55:59 EDT (Sun, 05 Apr 2009)
New Revision: 52196
URL: http://svn.boost.org/trac/boost/changeset/52196
Log:
bug-fixes from trunk
Text files modified:
branches/release/boost/ptr_container/clone_allocator.hpp | 13 +++++++++++++
branches/release/boost/ptr_container/detail/reversible_ptr_container.hpp | 14 ++++++++++----
branches/release/boost/ptr_container/indirect_fun.hpp | 12 ++++++------
branches/release/boost/ptr_container/ptr_sequence_adapter.hpp | 6 +++---
branches/release/boost/ptr_container/ptr_set_adapter.hpp | 10 ++++++----
5 files changed, 38 insertions(+), 17 deletions(-)
Modified: branches/release/boost/ptr_container/clone_allocator.hpp
==============================================================================
--- branches/release/boost/ptr_container/clone_allocator.hpp (original)
+++ branches/release/boost/ptr_container/clone_allocator.hpp 2009-04-05 15:55:59 EDT (Sun, 05 Apr 2009)
@@ -38,6 +38,19 @@
}
template< class T >
+ inline T* new_clone( const T* r )
+ {
+ return r ? new_clone( *r ) : 0;
+ }
+
+ //
+ // @remark: to make new_clone() work
+ // with scope_ptr/shared_ptr ect.
+ // simply overload for those types
+ // in the appropriate namespace.
+ //
+
+ template< class T >
inline void delete_clone( const T* r )
{
checked_delete( r );
Modified: branches/release/boost/ptr_container/detail/reversible_ptr_container.hpp
==============================================================================
--- branches/release/boost/ptr_container/detail/reversible_ptr_container.hpp (original)
+++ branches/release/boost/ptr_container/detail/reversible_ptr_container.hpp 2009-04-05 15:55:59 EDT (Sun, 05 Apr 2009)
@@ -238,6 +238,12 @@
sd.release();
}
+ template< class U >
+ void remove( U* ptr )
+ {
+ null_policy_deallocate_clone( ptr );
+ }
+
template< class I >
void remove( I i )
{
@@ -437,18 +443,18 @@
: c_( n ) {}
template< class Hash, class Pred >
- reversible_ptr_container( const Hash& hash,
+ reversible_ptr_container( const Hash& h,
const Pred& pred,
const allocator_type& a )
- : c_( hash, pred, a ) {}
+ : c_( h, pred, a ) {}
template< class InputIterator, class Hash, class Pred >
reversible_ptr_container( InputIterator first,
InputIterator last,
- const Hash& hash,
+ const Hash& h,
const Pred& pred,
const allocator_type& a )
- : c_( hash, pred, a )
+ : c_( h, pred, a )
{
associative_constructor_impl( first, last );
}
Modified: branches/release/boost/ptr_container/indirect_fun.hpp
==============================================================================
--- branches/release/boost/ptr_container/indirect_fun.hpp (original)
+++ branches/release/boost/ptr_container/indirect_fun.hpp 2009-04-05 15:55:59 EDT (Sun, 05 Apr 2009)
@@ -1,7 +1,7 @@
//
// Boost.Pointer Container
//
-// Copyright Thorsten Ottosen 2003-2005. Use, modification and
+// Copyright Thorsten Ottosen 2003-2007. Use, modification and
// distribution is subject to 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)
@@ -53,7 +53,7 @@
#ifdef BOOST_NO_SFINAE
Result
#else
- BOOST_DEDUCED_TYPENAME result_of< Fun( BOOST_DEDUCED_TYPENAME pointee<T>::type ) >::type
+ BOOST_DEDUCED_TYPENAME result_of< Fun( BOOST_DEDUCED_TYPENAME pointee<T>::type& ) >::type
#endif
operator()( const T& r ) const
{
@@ -64,8 +64,8 @@
#ifdef BOOST_NO_SFINAE
Result
#else
- BOOST_DEDUCED_TYPENAME result_of< Fun( BOOST_DEDUCED_TYPENAME pointee<T>::type,
- BOOST_DEDUCED_TYPENAME pointee<U>::type ) >::type
+ BOOST_DEDUCED_TYPENAME result_of< Fun( BOOST_DEDUCED_TYPENAME pointee<T>::type&,
+ BOOST_DEDUCED_TYPENAME pointee<U>::type& ) >::type
#endif
operator()( const T& r, const U& r2 ) const
{
@@ -102,7 +102,7 @@
#ifdef BOOST_NO_SFINAE
Result
#else
- BOOST_DEDUCED_TYPENAME result_of< Fun( Arg1 ) >::type
+ BOOST_DEDUCED_TYPENAME result_of< Fun( Arg1& ) >::type
#endif
operator()( const void* r ) const
{
@@ -113,7 +113,7 @@
#ifdef BOOST_NO_SFINAE
Result
#else
- BOOST_DEDUCED_TYPENAME result_of< Fun( Arg1, Arg2 ) >::type
+ BOOST_DEDUCED_TYPENAME result_of< Fun( Arg1&, Arg2& ) >::type
#endif
operator()( const void* l, const void* r ) const
{
Modified: branches/release/boost/ptr_container/ptr_sequence_adapter.hpp
==============================================================================
--- branches/release/boost/ptr_container/ptr_sequence_adapter.hpp (original)
+++ branches/release/boost/ptr_container/ptr_sequence_adapter.hpp 2009-04-05 15:55:59 EDT (Sun, 05 Apr 2009)
@@ -9,8 +9,8 @@
// For more information, see http://www.boost.org/libs/ptr_container/
//
-#ifndef BOOST_ptr_container_PTR_SEQUENCE_ADAPTER_HPP
-#define BOOST_ptr_container_PTR_SEQUENCE_ADAPTER_HPP
+#ifndef BOOST_PTR_CONTAINER_PTR_SEQUENCE_ADAPTER_HPP
+#define BOOST_PTR_CONTAINER_PTR_SEQUENCE_ADAPTER_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
@@ -723,7 +723,7 @@
range_check(first,last);
this->base().erase( std::remove_if( first.base(), last.base(),
void_ptr_delete_if<Pred,value_type>(pred) ),
- this->base().end() );
+ last.base() );
}
template< class Pred >
Modified: branches/release/boost/ptr_container/ptr_set_adapter.hpp
==============================================================================
--- branches/release/boost/ptr_container/ptr_set_adapter.hpp (original)
+++ branches/release/boost/ptr_container/ptr_set_adapter.hpp 2009-04-05 15:55:59 EDT (Sun, 05 Apr 2009)
@@ -204,12 +204,14 @@
size_type erase( const key_type& x ) // nothrow
{
- iterator i( this->base().find( const_cast<key_type*>(&x) ) );
- // nothrow
+ key_type* key = const_cast<key_type*>(&x);
+ iterator i( this->base().find( key ) );
if( i == this->end() ) // nothrow
return 0u; // nothrow
- this->remove( i ); // nothrow
- return this->base().erase( const_cast<key_type*>(&x) ); // nothrow
+ key = static_cast<key_type*>(*i.base()); // nothrow
+ size_type res = this->base().erase( key ); // nothrow
+ this->remove( key ); // nothrow
+ return res;
}
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