mirror of
https://github.com/boostorg/ptr_container.git
synced 2026-01-19 04:22:16 +00:00
Merge branch 'feature/use_invoke_swap' of https://github.com/Lastique/ptr_container into feature/pr-38
This commit is contained in:
@@ -19,9 +19,9 @@
|
||||
namespace boost
|
||||
{
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// Clonable concept
|
||||
// Clonable concept
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
template< class T >
|
||||
inline T* new_clone( const T& r )
|
||||
{
|
||||
@@ -38,7 +38,7 @@ namespace boost
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
template< class T >
|
||||
inline void delete_clone( const T* r )
|
||||
{
|
||||
@@ -48,7 +48,7 @@ namespace boost
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// CloneAllocator concept
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
struct heap_clone_allocator
|
||||
{
|
||||
template< class U >
|
||||
@@ -66,7 +66,7 @@ namespace boost
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
struct view_clone_allocator
|
||||
{
|
||||
template< class U >
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace ptr_container_detail
|
||||
const Allocator& a )
|
||||
: base_type( comp, a, container_type() )
|
||||
{ }
|
||||
|
||||
|
||||
template< class Hash, class Pred, class Allocator >
|
||||
associative_ptr_container( const Hash& hash,
|
||||
const Pred& pred,
|
||||
@@ -100,7 +100,7 @@ namespace ptr_container_detail
|
||||
const Allocator& a )
|
||||
: base_type( first, last, comp, a, container_type() )
|
||||
{ }
|
||||
|
||||
|
||||
template< class InputIterator, class Hash, class Pred, class Allocator >
|
||||
associative_ptr_container( InputIterator first, InputIterator last,
|
||||
const Hash& hash,
|
||||
@@ -108,7 +108,7 @@ namespace ptr_container_detail
|
||||
const Allocator& a )
|
||||
: base_type( first, last, hash, pred, a )
|
||||
{ }
|
||||
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
template< class PtrContainer >
|
||||
explicit associative_ptr_container( std::auto_ptr<PtrContainer> r )
|
||||
@@ -125,12 +125,12 @@ namespace ptr_container_detail
|
||||
associative_ptr_container( const associative_ptr_container& r )
|
||||
: base_type( r.begin(), r.end(), container_type() )
|
||||
{ }
|
||||
|
||||
|
||||
template< class C, class V >
|
||||
associative_ptr_container( const associative_ptr_container<C,V>& r )
|
||||
: base_type( r.begin(), r.end(), container_type() )
|
||||
{ }
|
||||
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
template< class PtrContainer >
|
||||
associative_ptr_container& operator=( std::auto_ptr<PtrContainer> r ) // nothrow
|
||||
@@ -147,11 +147,11 @@ namespace ptr_container_detail
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
associative_ptr_container& operator=( associative_ptr_container r ) // strong
|
||||
{
|
||||
this->swap( r );
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
public: // associative container interface
|
||||
@@ -179,12 +179,12 @@ namespace ptr_container_detail
|
||||
|
||||
size_type erase( const key_type& x ) // nothrow
|
||||
{
|
||||
iterator i( this->base().find( x ) );
|
||||
iterator i( this->base().find( x ) );
|
||||
// nothrow
|
||||
if( i == this->end() ) // nothrow
|
||||
return 0u; // nothrow
|
||||
this->remove( i ); // nothrow
|
||||
return this->base().erase( x ); // nothrow
|
||||
return this->base().erase( x ); // nothrow
|
||||
}
|
||||
|
||||
iterator erase( iterator first,
|
||||
@@ -200,9 +200,9 @@ namespace ptr_container_detail
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
#else
|
||||
#else
|
||||
template< class Range >
|
||||
BOOST_DEDUCED_TYPENAME boost::disable_if< boost::is_convertible<Range&,key_type&>,
|
||||
BOOST_DEDUCED_TYPENAME boost::disable_if< boost::is_convertible<Range&,key_type&>,
|
||||
iterator >::type
|
||||
erase( const Range& r )
|
||||
{
|
||||
@@ -230,13 +230,13 @@ namespace ptr_container_detail
|
||||
AssociatePtrCont& from ) // basic
|
||||
{
|
||||
BOOST_ASSERT( (void*)&from != (void*)this );
|
||||
|
||||
|
||||
size_type res = 0;
|
||||
for( ; first != last; )
|
||||
{
|
||||
BOOST_ASSERT( first != from.end() );
|
||||
this->base().insert( *first.base() ); // strong
|
||||
BOOST_DEDUCED_TYPENAME AssociatePtrCont::iterator
|
||||
BOOST_DEDUCED_TYPENAME AssociatePtrCont::iterator
|
||||
to_delete( first );
|
||||
++first;
|
||||
from.base().erase( to_delete.base() ); // nothrow
|
||||
@@ -274,7 +274,7 @@ namespace ptr_container_detail
|
||||
BOOST_ASSERT( first != from.end() );
|
||||
std::pair<BOOST_DEDUCED_TYPENAME base_type::ptr_iterator,bool> p =
|
||||
this->base().insert( *first.base() ); // strong
|
||||
BOOST_DEDUCED_TYPENAME AssociatePtrCont::iterator
|
||||
BOOST_DEDUCED_TYPENAME AssociatePtrCont::iterator
|
||||
to_delete( first );
|
||||
++first;
|
||||
if( p.second )
|
||||
@@ -285,12 +285,12 @@ namespace ptr_container_detail
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
reference front()
|
||||
{
|
||||
BOOST_ASSERT( !this->empty() );
|
||||
BOOST_ASSERT( *this->begin().base() != 0 );
|
||||
return *this->begin();
|
||||
return *this->begin();
|
||||
}
|
||||
|
||||
const_reference front() const
|
||||
@@ -302,7 +302,7 @@ namespace ptr_container_detail
|
||||
{
|
||||
BOOST_ASSERT( !this->empty() );
|
||||
BOOST_ASSERT( *(--this->end()).base() != 0 );
|
||||
return *--this->end();
|
||||
return *--this->end();
|
||||
}
|
||||
|
||||
const_reference back() const
|
||||
@@ -320,37 +320,37 @@ namespace ptr_container_detail
|
||||
{
|
||||
return this->base().key_eq();
|
||||
}
|
||||
|
||||
|
||||
size_type bucket_count() const
|
||||
{
|
||||
return this->base().bucket_count();
|
||||
}
|
||||
|
||||
|
||||
size_type max_bucket_count() const
|
||||
{
|
||||
return this->base().max_bucket_count();
|
||||
}
|
||||
|
||||
|
||||
size_type bucket_size( size_type n ) const
|
||||
{
|
||||
return this->base().bucket_size( n );
|
||||
}
|
||||
|
||||
|
||||
float load_factor() const
|
||||
{
|
||||
return this->base().load_factor();
|
||||
}
|
||||
|
||||
|
||||
float max_load_factor() const
|
||||
{
|
||||
return this->base().max_load_factor();
|
||||
}
|
||||
|
||||
|
||||
void max_load_factor( float factor )
|
||||
{
|
||||
return this->base().max_load_factor( factor );
|
||||
}
|
||||
|
||||
|
||||
void rehash( size_type n )
|
||||
{
|
||||
this->base().rehash( n );
|
||||
@@ -399,36 +399,36 @@ namespace ptr_container_detail
|
||||
{
|
||||
return local_iterator( this->base().begin( n ) );
|
||||
}
|
||||
|
||||
|
||||
const_local_iterator begin( size_type n ) const
|
||||
{
|
||||
return const_local_iterator( this->base().begin( n ) );
|
||||
}
|
||||
|
||||
|
||||
local_iterator end( size_type n )
|
||||
{
|
||||
return local_iterator( this->base().end( n ) );
|
||||
}
|
||||
|
||||
|
||||
const_local_iterator end( size_type n ) const
|
||||
{
|
||||
return const_local_iterator( this->base().end( n ) );
|
||||
}
|
||||
|
||||
|
||||
const_local_iterator cbegin( size_type n ) const
|
||||
{
|
||||
return const_local_iterator( this->base().cbegin( n ) );
|
||||
}
|
||||
|
||||
|
||||
const_local_iterator cend( size_type n )
|
||||
{
|
||||
return const_local_iterator( this->base().cend( n ) );
|
||||
}
|
||||
|
||||
}; // class 'associative_ptr_container'
|
||||
|
||||
|
||||
} // namespace 'ptr_container_detail'
|
||||
|
||||
|
||||
} // namespace 'boost'
|
||||
|
||||
#if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED)
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
|
||||
// Contains the definition of move_ptrs::default_deleter, the default
|
||||
// Deleter template argument to move_ptr. Uses a technique of Daniel
|
||||
// Wallin to capture the type of a pointer at the time the deleter
|
||||
// is constructed, so that move_ptrs can delete objects of incomplete
|
||||
// Wallin to capture the type of a pointer at the time the deleter
|
||||
// is constructed, so that move_ptrs can delete objects of incomplete
|
||||
// type by default.
|
||||
|
||||
#ifndef BOOST_MOVE_PTR_DEFAULT_DELETER_HPP_INCLUDED
|
||||
#define BOOST_MOVE_PTR_DEFAULT_DELETER_HPP_INCLUDED
|
||||
#define BOOST_MOVE_PTR_DEFAULT_DELETER_HPP_INCLUDED
|
||||
|
||||
#include <boost/checked_delete.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
@@ -29,7 +29,7 @@ struct deleter_base {
|
||||
};
|
||||
|
||||
template<class T>
|
||||
typename deleter_base<T>::deleter
|
||||
typename deleter_base<T>::deleter
|
||||
deleter_base<T>::delete_;
|
||||
|
||||
template<typename T>
|
||||
@@ -40,7 +40,7 @@ struct scalar_deleter : deleter_base<T> {
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct array_deleter
|
||||
struct array_deleter
|
||||
: deleter_base<typename remove_bounds<T>::type>
|
||||
{
|
||||
typedef typename remove_bounds<T>::type element_type;
|
||||
@@ -58,7 +58,7 @@ struct default_deleter
|
||||
ptr_container_detail::array_deleter<T>,
|
||||
ptr_container_detail::scalar_deleter<T>
|
||||
>::type
|
||||
{
|
||||
{
|
||||
default_deleter() { }
|
||||
template<typename TT>
|
||||
default_deleter(default_deleter<TT>) { }
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
//
|
||||
// Contains type traits machinery for incomplete arrays. MPL compatibility
|
||||
// is included for completeness, but is not necessary for the current
|
||||
// is included for completeness, but is not necessary for the current
|
||||
// application.
|
||||
//
|
||||
//
|
||||
|
||||
#ifndef BOOST_MOVE_PTR_ARRAYS_HPP_INCLUDED
|
||||
#define BOOST_MOVE_PTR_ARRAYS_HPP_INCLUDED
|
||||
@@ -31,11 +31,11 @@ namespace boost { namespace ptr_container_detail { namespace move_ptrs {
|
||||
// From Howard Hinnant.
|
||||
template<typename T, typename U>
|
||||
struct is_array_convertible {
|
||||
typedef typename remove_bounds<T>::type t_element;
|
||||
typedef typename remove_bounds<U>::type u_element;
|
||||
typedef typename remove_cv<t_element>::type t_base;
|
||||
typedef typename remove_cv<u_element>::type u_base;
|
||||
typedef typename
|
||||
typedef typename remove_bounds<T>::type t_element;
|
||||
typedef typename remove_bounds<U>::type u_element;
|
||||
typedef typename remove_cv<t_element>::type t_base;
|
||||
typedef typename remove_cv<u_element>::type u_base;
|
||||
typedef typename
|
||||
mpl::and_<
|
||||
is_array<T>,
|
||||
is_array<U>,
|
||||
@@ -47,18 +47,18 @@ struct is_array_convertible {
|
||||
};
|
||||
|
||||
template<typename T, typename U>
|
||||
struct is_smart_ptr_convertible
|
||||
struct is_smart_ptr_convertible
|
||||
: mpl::if_<
|
||||
is_array<T>,
|
||||
is_array_convertible<T, U>,
|
||||
is_convertible<T*, U*>
|
||||
is_convertible<T*, U*>
|
||||
>::type
|
||||
{ };
|
||||
|
||||
#ifndef BOOST_NO_SFINAE
|
||||
template<typename Src, typename Tgt, typename T = void>
|
||||
struct enable_if_convertible
|
||||
: enable_if<
|
||||
struct enable_if_convertible
|
||||
: enable_if<
|
||||
is_smart_ptr_convertible<Src, Tgt>,
|
||||
T
|
||||
>
|
||||
|
||||
@@ -21,13 +21,13 @@
|
||||
#include <boost/utility/compare_pointees.hpp>
|
||||
#include <utility>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:4512) // Assignment operator could not be generated.
|
||||
#endif
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:4512) // Assignment operator could not be generated.
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
{
|
||||
namespace ptr_container_detail
|
||||
{
|
||||
template< class F, class S >
|
||||
@@ -56,7 +56,7 @@ namespace boost
|
||||
|
||||
friend inline bool operator==( ref_pair l, ref_pair r )
|
||||
{
|
||||
return l.first == r.first &&
|
||||
return l.first == r.first &&
|
||||
boost::equal_pointees( l.second, r.second );
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace boost
|
||||
{
|
||||
if( l.first == r.first )
|
||||
return boost::less_pointees( l.second, r.second );
|
||||
else
|
||||
else
|
||||
return l.first < r.first;
|
||||
}
|
||||
|
||||
@@ -90,43 +90,43 @@ namespace boost
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
template<
|
||||
class I, // base iterator
|
||||
|
||||
template<
|
||||
class I, // base iterator
|
||||
class F, // first type, key type
|
||||
class S // second type, mapped type
|
||||
>
|
||||
class ptr_map_iterator :
|
||||
public boost::iterator_adaptor< ptr_map_iterator<I,F,S>, I,
|
||||
ptr_container_detail::ref_pair<F,S>,
|
||||
use_default,
|
||||
>
|
||||
class ptr_map_iterator :
|
||||
public boost::iterator_adaptor< ptr_map_iterator<I,F,S>, I,
|
||||
ptr_container_detail::ref_pair<F,S>,
|
||||
use_default,
|
||||
ptr_container_detail::ref_pair<F,S> >
|
||||
{
|
||||
typedef boost::iterator_adaptor< ptr_map_iterator<I,F,S>, I,
|
||||
typedef boost::iterator_adaptor< ptr_map_iterator<I,F,S>, I,
|
||||
ptr_container_detail::ref_pair<F,S>,
|
||||
use_default,
|
||||
ptr_container_detail::ref_pair<F,S> >
|
||||
use_default,
|
||||
ptr_container_detail::ref_pair<F,S> >
|
||||
base_type;
|
||||
|
||||
|
||||
public:
|
||||
ptr_map_iterator() : base_type()
|
||||
ptr_map_iterator() : base_type()
|
||||
{ }
|
||||
|
||||
|
||||
explicit ptr_map_iterator( const I& i ) : base_type(i)
|
||||
{ }
|
||||
|
||||
template< class I2, class F2, class S2 >
|
||||
ptr_map_iterator( const ptr_map_iterator<I2,F2,S2>& r )
|
||||
ptr_map_iterator( const ptr_map_iterator<I2,F2,S2>& r )
|
||||
: base_type(r.base())
|
||||
{ }
|
||||
|
||||
|
||||
}; // class 'ptr_map_iterator'
|
||||
|
||||
}
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace ptr_container_detail
|
||||
{
|
||||
typedef typename T::iterator type;
|
||||
};
|
||||
|
||||
|
||||
template< class T >
|
||||
struct select_local_iterator
|
||||
{
|
||||
|
||||
@@ -12,11 +12,11 @@ namespace boost { namespace ptr_container_detail {
|
||||
|
||||
namespace move_ptrs {
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4512)
|
||||
#endif
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4512)
|
||||
#endif
|
||||
|
||||
template<typename Ptr>
|
||||
class move_source {
|
||||
public:
|
||||
@@ -27,15 +27,15 @@ private:
|
||||
move_source(const Ptr&);
|
||||
};
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
} // End namespace move_ptrs.
|
||||
|
||||
|
||||
template<typename T>
|
||||
move_ptrs::move_source<T> move(T& x)
|
||||
move_ptrs::move_source<T> move(T& x)
|
||||
{ return move_ptrs::move_source<T>(x); }
|
||||
|
||||
} // namespace 'ptr_container_detail'
|
||||
|
||||
@@ -36,15 +36,15 @@
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/type_traits/is_pointer.hpp>
|
||||
#include <boost/type_traits/is_integral.hpp>
|
||||
#include <boost/swap.hpp>
|
||||
#include <boost/core/invoke_swap.hpp>
|
||||
#include <typeinfo>
|
||||
#include <memory>
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
#pragma warning(push)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4127)
|
||||
#pragma warning(disable:4224) // formal parameter was previously defined as a type.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED)
|
||||
#pragma GCC diagnostic push
|
||||
@@ -77,7 +77,7 @@ namespace ptr_container_detail
|
||||
static_clone_deleter() { }
|
||||
template< class Dummy >
|
||||
static_clone_deleter( const Dummy& ) { }
|
||||
|
||||
|
||||
template< class T >
|
||||
void operator()( const T* p ) const
|
||||
{
|
||||
@@ -99,12 +99,12 @@ namespace ptr_container_detail
|
||||
struct associative_container_tag {};
|
||||
struct ordered_associative_container_tag : associative_container_tag {};
|
||||
struct unordered_associative_container_tag : associative_container_tag {};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
class Config,
|
||||
<
|
||||
class Config,
|
||||
class CloneAllocator
|
||||
>
|
||||
class reversible_ptr_container : CloneAllocator
|
||||
@@ -117,74 +117,74 @@ namespace ptr_container_detail
|
||||
typedef BOOST_DEDUCED_TYPENAME Config::void_container_type container_type;
|
||||
typedef dynamic_clone_deleter<reversible_ptr_container> dynamic_deleter_type;
|
||||
typedef static_clone_deleter<CloneAllocator> static_deleter_type;
|
||||
|
||||
|
||||
container_type c_;
|
||||
|
||||
public:
|
||||
container_type& base() { return c_; }
|
||||
protected: // having this public could break encapsulation
|
||||
const container_type& base() const { return c_; }
|
||||
|
||||
const container_type& base() const { return c_; }
|
||||
|
||||
public: // typedefs
|
||||
typedef Ty_ object_type;
|
||||
typedef Ty_* value_type;
|
||||
typedef Ty_* pointer;
|
||||
typedef Ty_& reference;
|
||||
typedef const Ty_& const_reference;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME Config::iterator
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME Config::iterator
|
||||
iterator;
|
||||
typedef BOOST_DEDUCED_TYPENAME Config::const_iterator
|
||||
const_iterator;
|
||||
typedef boost::reverse_iterator< iterator >
|
||||
reverse_iterator;
|
||||
typedef boost::reverse_iterator< const_iterator >
|
||||
typedef boost::reverse_iterator< iterator >
|
||||
reverse_iterator;
|
||||
typedef boost::reverse_iterator< const_iterator >
|
||||
const_reverse_iterator;
|
||||
typedef BOOST_DEDUCED_TYPENAME container_type::difference_type
|
||||
difference_type;
|
||||
difference_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME container_type::size_type
|
||||
size_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME Config::allocator_type
|
||||
allocator_type;
|
||||
typedef CloneAllocator clone_allocator_type;
|
||||
typedef ptr_container_detail::static_move_ptr<Ty_,
|
||||
typedef ptr_container_detail::static_move_ptr<Ty_,
|
||||
BOOST_DEDUCED_TYPENAME boost::mpl::if_c<is_clone_allocator_empty,
|
||||
static_deleter_type,
|
||||
dynamic_deleter_type>::type
|
||||
dynamic_deleter_type>::type
|
||||
>
|
||||
auto_type;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
typedef ptr_container_detail::scoped_deleter<reversible_ptr_container>
|
||||
scoped_deleter;
|
||||
typedef BOOST_DEDUCED_TYPENAME container_type::iterator
|
||||
ptr_iterator;
|
||||
ptr_iterator;
|
||||
typedef BOOST_DEDUCED_TYPENAME container_type::const_iterator
|
||||
ptr_const_iterator;
|
||||
ptr_const_iterator;
|
||||
private:
|
||||
|
||||
template< class InputIterator >
|
||||
void copy( InputIterator first, InputIterator last )
|
||||
template< class InputIterator >
|
||||
void copy( InputIterator first, InputIterator last )
|
||||
{
|
||||
std::copy( first, last, begin() );
|
||||
}
|
||||
|
||||
|
||||
void copy( const reversible_ptr_container& r )
|
||||
{
|
||||
{
|
||||
this->copy( r.begin(), r.end() );
|
||||
}
|
||||
|
||||
|
||||
void copy_clones_and_release( scoped_deleter& sd ) // nothrow
|
||||
{
|
||||
BOOST_ASSERT( size_type( std::distance( sd.begin(), sd.end() ) ) == c_.size() );
|
||||
std::copy( sd.begin(), sd.end(), c_.begin() );
|
||||
sd.release();
|
||||
sd.release();
|
||||
}
|
||||
|
||||
|
||||
template< class ForwardIterator >
|
||||
void clone_assign( ForwardIterator first,
|
||||
ForwardIterator last ) // strong
|
||||
void clone_assign( ForwardIterator first,
|
||||
ForwardIterator last ) // strong
|
||||
{
|
||||
BOOST_ASSERT( first != last );
|
||||
scoped_deleter sd( *this, first, last ); // strong
|
||||
@@ -199,23 +199,23 @@ namespace ptr_container_detail
|
||||
scoped_deleter sd( *this, first, last );
|
||||
insert_clones_and_release( sd, end() );
|
||||
}
|
||||
|
||||
void remove_all()
|
||||
|
||||
void remove_all()
|
||||
{
|
||||
this->remove( begin(), end() );
|
||||
this->remove( begin(), end() );
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
void insert_clones_and_release( scoped_deleter& sd,
|
||||
void insert_clones_and_release( scoped_deleter& sd,
|
||||
iterator where ) // strong
|
||||
{
|
||||
//
|
||||
// 'c_.insert' always provides the strong guarantee for T* elements
|
||||
// since a copy constructor of a pointer cannot throw
|
||||
//
|
||||
c_.insert( where.base(),
|
||||
sd.begin(), sd.end() );
|
||||
c_.insert( where.base(),
|
||||
sd.begin(), sd.end() );
|
||||
sd.release();
|
||||
}
|
||||
|
||||
@@ -230,15 +230,15 @@ namespace ptr_container_detail
|
||||
{
|
||||
this->deallocate_clone( ptr );
|
||||
}
|
||||
|
||||
|
||||
template< class I >
|
||||
void remove( I i )
|
||||
{
|
||||
{
|
||||
this->deallocate_clone( Config::get_const_pointer(i) );
|
||||
}
|
||||
|
||||
template< class I >
|
||||
void remove( I first, I last )
|
||||
void remove( I first, I last )
|
||||
{
|
||||
for( ; first != last; ++first )
|
||||
this->remove( first );
|
||||
@@ -248,7 +248,7 @@ namespace ptr_container_detail
|
||||
{
|
||||
if( !allow_null )
|
||||
{
|
||||
BOOST_PTR_CONTAINER_THROW_EXCEPTION( 0 == x && "null not allowed",
|
||||
BOOST_PTR_CONTAINER_THROW_EXCEPTION( 0 == x && "null not allowed",
|
||||
bad_pointer, msg );
|
||||
}
|
||||
}
|
||||
@@ -279,7 +279,7 @@ namespace ptr_container_detail
|
||||
{
|
||||
return this->null_policy_allocate_clone(Config::get_const_pointer(i));
|
||||
}
|
||||
|
||||
|
||||
void null_policy_deallocate_clone( const Ty_* x )
|
||||
{
|
||||
if( allow_null )
|
||||
@@ -290,15 +290,15 @@ namespace ptr_container_detail
|
||||
|
||||
this->get_clone_allocator().deallocate_clone( x );
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
template< class ForwardIterator >
|
||||
ForwardIterator advance( ForwardIterator begin, size_type n )
|
||||
ForwardIterator advance( ForwardIterator begin, size_type n )
|
||||
{
|
||||
ForwardIterator iter = begin;
|
||||
std::advance( iter, n );
|
||||
return iter;
|
||||
}
|
||||
}
|
||||
|
||||
template< class I >
|
||||
void constructor_impl( I first, I last, std::input_iterator_tag ) // basic
|
||||
@@ -325,7 +325,7 @@ namespace ptr_container_detail
|
||||
return;
|
||||
|
||||
scoped_deleter sd( *this, first, last );
|
||||
insert_clones_and_release( sd );
|
||||
insert_clones_and_release( sd );
|
||||
}
|
||||
|
||||
public: // foundation: should be protected, but public for poor compilers' sake.
|
||||
@@ -343,12 +343,12 @@ namespace ptr_container_detail
|
||||
{ }
|
||||
|
||||
template< class SizeType >
|
||||
reversible_ptr_container( SizeType n, const allocator_type& a,
|
||||
reversible_ptr_container( SizeType n, const allocator_type& a,
|
||||
fixed_length_sequence_tag )
|
||||
: c_( n, a )
|
||||
{ }
|
||||
|
||||
explicit reversible_ptr_container( const allocator_type& a )
|
||||
|
||||
explicit reversible_ptr_container( const allocator_type& a )
|
||||
: c_( a )
|
||||
{ }
|
||||
|
||||
@@ -367,15 +367,15 @@ namespace ptr_container_detail
|
||||
}
|
||||
#endif
|
||||
|
||||
reversible_ptr_container( const reversible_ptr_container& r )
|
||||
reversible_ptr_container( const reversible_ptr_container& r )
|
||||
{
|
||||
constructor_impl( r.begin(), r.end(), std::forward_iterator_tag() );
|
||||
constructor_impl( r.begin(), r.end(), std::forward_iterator_tag() );
|
||||
}
|
||||
|
||||
template< class C, class V >
|
||||
reversible_ptr_container( const reversible_ptr_container<C,V>& r )
|
||||
reversible_ptr_container( const reversible_ptr_container<C,V>& r )
|
||||
{
|
||||
constructor_impl( r.begin(), r.end(), std::forward_iterator_tag() );
|
||||
constructor_impl( r.begin(), r.end(), std::forward_iterator_tag() );
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
@@ -395,25 +395,25 @@ namespace ptr_container_detail
|
||||
}
|
||||
#endif
|
||||
|
||||
reversible_ptr_container& operator=( reversible_ptr_container r ) // strong
|
||||
reversible_ptr_container& operator=( reversible_ptr_container r ) // strong
|
||||
{
|
||||
swap( r );
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
// overhead: null-initilization of container pointer (very cheap compared to cloning)
|
||||
// overhead: 1 heap allocation (very cheap compared to cloning)
|
||||
template< class InputIterator >
|
||||
reversible_ptr_container( InputIterator first,
|
||||
reversible_ptr_container( InputIterator first,
|
||||
InputIterator last,
|
||||
const allocator_type& a = allocator_type() ) // basic, strong
|
||||
: c_( a )
|
||||
{
|
||||
constructor_impl( first, last,
|
||||
{
|
||||
constructor_impl( first, last,
|
||||
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
#else
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
#endif
|
||||
#endif
|
||||
iterator_category<InputIterator>::type() );
|
||||
}
|
||||
|
||||
@@ -428,7 +428,7 @@ namespace ptr_container_detail
|
||||
fixed_length_sequence_tag )
|
||||
: c_( std::distance(first,last) )
|
||||
{
|
||||
constructor_impl( first, last,
|
||||
constructor_impl( first, last,
|
||||
std::forward_iterator_tag() );
|
||||
}
|
||||
|
||||
@@ -439,11 +439,11 @@ namespace ptr_container_detail
|
||||
fixed_length_sequence_tag )
|
||||
: c_( n )
|
||||
{
|
||||
constructor_impl( first, last,
|
||||
constructor_impl( first, last,
|
||||
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
#else
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
#endif
|
||||
#endif
|
||||
iterator_category<InputIterator>::type() );
|
||||
}
|
||||
|
||||
@@ -453,7 +453,7 @@ namespace ptr_container_detail
|
||||
associative_container_tag )
|
||||
: c_( comp, a )
|
||||
{ }
|
||||
|
||||
|
||||
template< class InputIterator >
|
||||
reversible_ptr_container( InputIterator first,
|
||||
InputIterator last,
|
||||
@@ -461,14 +461,14 @@ namespace ptr_container_detail
|
||||
{
|
||||
associative_constructor_impl( first, last );
|
||||
}
|
||||
|
||||
|
||||
template< class InputIterator, class Compare >
|
||||
reversible_ptr_container( InputIterator first,
|
||||
InputIterator last,
|
||||
const Compare& comp,
|
||||
const allocator_type& a,
|
||||
associative_container_tag )
|
||||
: c_( comp, a )
|
||||
: c_( comp, a )
|
||||
{
|
||||
associative_constructor_impl( first, last );
|
||||
}
|
||||
@@ -493,64 +493,64 @@ namespace ptr_container_detail
|
||||
associative_constructor_impl( first, last );
|
||||
}
|
||||
|
||||
public:
|
||||
public:
|
||||
~reversible_ptr_container()
|
||||
{
|
||||
{
|
||||
remove_all();
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
|
||||
allocator_type get_allocator() const
|
||||
|
||||
allocator_type get_allocator() const
|
||||
{
|
||||
return c_.get_allocator();
|
||||
return c_.get_allocator();
|
||||
}
|
||||
|
||||
|
||||
clone_allocator_type& get_clone_allocator()
|
||||
{
|
||||
return static_cast<clone_allocator_type&>(*this);
|
||||
}
|
||||
|
||||
|
||||
const clone_allocator_type& get_clone_allocator() const
|
||||
{
|
||||
return static_cast<const clone_allocator_type&>(*this);
|
||||
}
|
||||
|
||||
|
||||
public: // container requirements
|
||||
iterator begin()
|
||||
iterator begin()
|
||||
{ return iterator( c_.begin() ); }
|
||||
const_iterator begin() const
|
||||
const_iterator begin() const
|
||||
{ return const_iterator( c_.begin() ); }
|
||||
iterator end()
|
||||
iterator end()
|
||||
{ return iterator( c_.end() ); }
|
||||
const_iterator end() const
|
||||
{ return const_iterator( c_.end() ); }
|
||||
|
||||
reverse_iterator rbegin()
|
||||
{ return reverse_iterator( this->end() ); }
|
||||
const_reverse_iterator rbegin() const
|
||||
{ return const_reverse_iterator( this->end() ); }
|
||||
reverse_iterator rend()
|
||||
{ return reverse_iterator( this->begin() ); }
|
||||
const_reverse_iterator rend() const
|
||||
{ return const_reverse_iterator( this->begin() ); }
|
||||
|
||||
const_iterator cbegin() const
|
||||
{ return const_iterator( c_.begin() ); }
|
||||
const_iterator cend() const
|
||||
const_iterator end() const
|
||||
{ return const_iterator( c_.end() ); }
|
||||
|
||||
const_reverse_iterator crbegin() const
|
||||
reverse_iterator rbegin()
|
||||
{ return reverse_iterator( this->end() ); }
|
||||
const_reverse_iterator rbegin() const
|
||||
{ return const_reverse_iterator( this->end() ); }
|
||||
const_reverse_iterator crend() const
|
||||
reverse_iterator rend()
|
||||
{ return reverse_iterator( this->begin() ); }
|
||||
const_reverse_iterator rend() const
|
||||
{ return const_reverse_iterator( this->begin() ); }
|
||||
|
||||
const_iterator cbegin() const
|
||||
{ return const_iterator( c_.begin() ); }
|
||||
const_iterator cend() const
|
||||
{ return const_iterator( c_.end() ); }
|
||||
|
||||
const_reverse_iterator crbegin() const
|
||||
{ return const_reverse_iterator( this->end() ); }
|
||||
const_reverse_iterator crend() const
|
||||
{ return const_reverse_iterator( this->begin() ); }
|
||||
|
||||
void swap( reversible_ptr_container& r ) // nothrow
|
||||
{
|
||||
boost::swap( get_clone_allocator(), r.get_clone_allocator() ); // nothrow
|
||||
{
|
||||
boost::core::invoke_swap( get_clone_allocator(), r.get_clone_allocator() ); // nothrow
|
||||
c_.swap( r.c_ ); // nothrow
|
||||
}
|
||||
|
||||
|
||||
size_type size() const // nothrow
|
||||
{
|
||||
return c_.size();
|
||||
@@ -558,9 +558,9 @@ namespace ptr_container_detail
|
||||
|
||||
size_type max_size() const // nothrow
|
||||
{
|
||||
return c_.max_size();
|
||||
return c_.max_size();
|
||||
}
|
||||
|
||||
|
||||
bool empty() const // nothrow
|
||||
{
|
||||
return c_.empty();
|
||||
@@ -569,7 +569,7 @@ namespace ptr_container_detail
|
||||
public: // optional container requirements
|
||||
|
||||
bool operator==( const reversible_ptr_container& r ) const // nothrow
|
||||
{
|
||||
{
|
||||
if( size() != r.size() )
|
||||
return false;
|
||||
else
|
||||
@@ -580,23 +580,23 @@ namespace ptr_container_detail
|
||||
{
|
||||
return !(*this == r);
|
||||
}
|
||||
|
||||
bool operator<( const reversible_ptr_container& r ) const // nothrow
|
||||
|
||||
bool operator<( const reversible_ptr_container& r ) const // nothrow
|
||||
{
|
||||
return std::lexicographical_compare( begin(), end(), r.begin(), r.end() );
|
||||
}
|
||||
|
||||
bool operator<=( const reversible_ptr_container& r ) const // nothrow
|
||||
bool operator<=( const reversible_ptr_container& r ) const // nothrow
|
||||
{
|
||||
return !(r < *this);
|
||||
}
|
||||
|
||||
bool operator>( const reversible_ptr_container& r ) const // nothrow
|
||||
bool operator>( const reversible_ptr_container& r ) const // nothrow
|
||||
{
|
||||
return r < *this;
|
||||
}
|
||||
|
||||
bool operator>=( const reversible_ptr_container& r ) const // nothrow
|
||||
bool operator>=( const reversible_ptr_container& r ) const // nothrow
|
||||
{
|
||||
return !(*this < r);
|
||||
}
|
||||
@@ -655,32 +655,32 @@ namespace ptr_container_detail
|
||||
remove_all();
|
||||
c_.clear();
|
||||
}
|
||||
|
||||
|
||||
public: // access interface
|
||||
|
||||
|
||||
auto_type release( iterator where )
|
||||
{
|
||||
{
|
||||
BOOST_ASSERT( where != end() );
|
||||
|
||||
|
||||
BOOST_PTR_CONTAINER_THROW_EXCEPTION( empty(), bad_ptr_container_operation,
|
||||
"'release()' on empty container" );
|
||||
|
||||
"'release()' on empty container" );
|
||||
|
||||
auto_type ptr( Config::get_pointer(where), *this ); // nothrow
|
||||
c_.erase( where.base() ); // nothrow
|
||||
return boost::ptr_container_detail::move( ptr );
|
||||
return boost::ptr_container_detail::move( ptr );
|
||||
}
|
||||
|
||||
auto_type replace( iterator where, Ty_* x ) // strong
|
||||
{
|
||||
auto_type replace( iterator where, Ty_* x ) // strong
|
||||
{
|
||||
BOOST_ASSERT( where != end() );
|
||||
enforce_null_policy( x, "Null pointer in 'replace()'" );
|
||||
enforce_null_policy( x, "Null pointer in 'replace()'" );
|
||||
|
||||
auto_type ptr( x, *this );
|
||||
BOOST_PTR_CONTAINER_THROW_EXCEPTION( empty(), bad_ptr_container_operation,
|
||||
"'replace()' on empty container" );
|
||||
|
||||
auto_type old( Config::get_pointer(where), *this ); // nothrow
|
||||
const_cast<void*&>(*where.base()) = ptr.release();
|
||||
auto_type old( Config::get_pointer(where), *this ); // nothrow
|
||||
const_cast<void*&>(*where.base()) = ptr.release();
|
||||
return boost::ptr_container_detail::move( old );
|
||||
}
|
||||
|
||||
@@ -701,16 +701,16 @@ namespace ptr_container_detail
|
||||
|
||||
auto_type replace( size_type idx, Ty_* x ) // strong
|
||||
{
|
||||
enforce_null_policy( x, "Null pointer in 'replace()'" );
|
||||
enforce_null_policy( x, "Null pointer in 'replace()'" );
|
||||
|
||||
auto_type ptr( x, *this );
|
||||
BOOST_PTR_CONTAINER_THROW_EXCEPTION( idx >= size(), bad_index,
|
||||
auto_type ptr( x, *this );
|
||||
BOOST_PTR_CONTAINER_THROW_EXCEPTION( idx >= size(), bad_index,
|
||||
"'replace()' out of bounds" );
|
||||
|
||||
|
||||
auto_type old( static_cast<Ty_*>(c_[idx]), *this ); // nothrow
|
||||
c_[idx] = ptr.release(); // nothrow, commit
|
||||
return boost::ptr_container_detail::move( old );
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
template< class U >
|
||||
@@ -726,17 +726,17 @@ namespace ptr_container_detail
|
||||
return replace( idx, x.release() );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
}; // 'reversible_ptr_container'
|
||||
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
#define BOOST_PTR_CONTAINER_DEFINE_RELEASE( base_type ) \
|
||||
typename base_type::auto_type \
|
||||
release( typename base_type::iterator i ) \
|
||||
{ \
|
||||
return boost::ptr_container_detail::move(base_type::release(i)); \
|
||||
}
|
||||
}
|
||||
#else
|
||||
#define BOOST_PTR_CONTAINER_DEFINE_RELEASE( base_type ) \
|
||||
using base_type::release;
|
||||
@@ -820,7 +820,7 @@ namespace ptr_container_detail
|
||||
this->swap( r ); \
|
||||
return *this; \
|
||||
} \
|
||||
|
||||
|
||||
|
||||
#define BOOST_PTR_CONTAINER_DEFINE_CONSTRUCTORS( PC, base_type ) \
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::iterator iterator; \
|
||||
@@ -833,8 +833,8 @@ namespace ptr_container_detail
|
||||
PC( InputIterator first, InputIterator last ) : base_type( first, last ) {} \
|
||||
template< class InputIterator > \
|
||||
PC( InputIterator first, InputIterator last, \
|
||||
const allocator_type& a ) : base_type( first, last, a ) {}
|
||||
|
||||
const allocator_type& a ) : base_type( first, last, a ) {}
|
||||
|
||||
#define BOOST_PTR_CONTAINER_DEFINE_NON_INHERITED_MEMBERS( PC, base_type, this_type ) \
|
||||
BOOST_PTR_CONTAINER_DEFINE_CONSTRUCTORS( PC, base_type ) \
|
||||
BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( PC, base_type, this_type )
|
||||
@@ -849,18 +849,18 @@ namespace ptr_container_detail
|
||||
// @remark: expose movability of internal move-pointer
|
||||
//
|
||||
namespace ptr_container
|
||||
{
|
||||
{
|
||||
using ptr_container_detail::move;
|
||||
}
|
||||
|
||||
} // namespace 'boost'
|
||||
} // namespace 'boost'
|
||||
|
||||
#if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -30,36 +30,36 @@ namespace boost
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME Container::size_type size_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME Container::object_type T;
|
||||
|
||||
|
||||
Container& cont_;
|
||||
scoped_array<T*> ptrs_;
|
||||
size_type stored_;
|
||||
size_type stored_;
|
||||
bool released_;
|
||||
|
||||
|
||||
public:
|
||||
scoped_deleter( Container& cont, T** a, size_type size )
|
||||
: cont_(cont),
|
||||
ptrs_( a ),
|
||||
stored_( size ),
|
||||
scoped_deleter( Container& cont, T** a, size_type size )
|
||||
: cont_(cont),
|
||||
ptrs_( a ),
|
||||
stored_( size ),
|
||||
released_( false )
|
||||
{
|
||||
{
|
||||
BOOST_ASSERT( a );
|
||||
}
|
||||
|
||||
scoped_deleter( Container& cont, size_type size )
|
||||
: cont_(cont),
|
||||
ptrs_( new T*[size] ),
|
||||
stored_( 0 ),
|
||||
|
||||
scoped_deleter( Container& cont, size_type size )
|
||||
: cont_(cont),
|
||||
ptrs_( new T*[size] ),
|
||||
stored_( 0 ),
|
||||
released_( false )
|
||||
{
|
||||
BOOST_ASSERT( size > 0 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
scoped_deleter( Container& cont, size_type n, const T& x ) // strong
|
||||
: cont_(cont),
|
||||
ptrs_( new T*[n] ),
|
||||
: cont_(cont),
|
||||
ptrs_( new T*[n] ),
|
||||
stored_(0),
|
||||
released_( false )
|
||||
{
|
||||
@@ -69,7 +69,7 @@ namespace boost
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
template< class InputIterator >
|
||||
scoped_deleter ( Container& cont, InputIterator first, InputIterator last ) // strong
|
||||
: cont_(cont),
|
||||
@@ -82,49 +82,49 @@ namespace boost
|
||||
BOOST_ASSERT( stored_ > 0 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
~scoped_deleter()
|
||||
{
|
||||
if ( !released_ )
|
||||
{
|
||||
for( size_type i = 0u; i != stored_; ++i )
|
||||
cont_.null_policy_deallocate_clone( ptrs_[i] );
|
||||
cont_.null_policy_deallocate_clone( ptrs_[i] );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void add( T* t )
|
||||
{
|
||||
BOOST_ASSERT( ptrs_.get() != 0 );
|
||||
ptrs_[stored_] = t;
|
||||
++stored_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void release()
|
||||
{
|
||||
released_ = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
T** begin()
|
||||
{
|
||||
BOOST_ASSERT( ptrs_.get() != 0 );
|
||||
return &ptrs_[0];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
T** end()
|
||||
{
|
||||
BOOST_ASSERT( ptrs_.get() != 0 );
|
||||
return &ptrs_[stored_];
|
||||
}
|
||||
|
||||
|
||||
}; // class 'scoped_deleter'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
#include <boost/ptr_container/detail/serialize_xml_names.hpp>
|
||||
#include <boost/core/serialization.hpp>
|
||||
|
||||
namespace boost
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace serialization
|
||||
namespace serialization
|
||||
{
|
||||
|
||||
template<class Archive, class T, class VoidPtrMap, class CloneAllocator, bool Ordered>
|
||||
@@ -22,7 +22,7 @@ void save(Archive& ar, const ptr_container_detail::ptr_map_adapter_base<T, VoidP
|
||||
typedef ptr_container_detail::ptr_map_adapter_base<T, VoidPtrMap, CloneAllocator,Ordered> container;
|
||||
typedef BOOST_DEDUCED_TYPENAME container::const_iterator const_iterator;
|
||||
|
||||
ar << boost::serialization::make_nvp( ptr_container_detail::count(),
|
||||
ar << boost::serialization::make_nvp( ptr_container_detail::count(),
|
||||
ptr_container_detail::serialize_as_const(c.size()) );
|
||||
|
||||
const_iterator i = c.begin(), e = c.end();
|
||||
@@ -53,7 +53,7 @@ void load(Archive& ar, ptr_map_adapter<T, VoidPtrMap, CloneAllocator,Ordered>& c
|
||||
ar >> boost::serialization::make_nvp( ptr_container_detail::first(), key );
|
||||
ar >> boost::serialization::make_nvp( ptr_container_detail::second(), value );
|
||||
std::pair<iterator, bool> p = c.insert(key, value);
|
||||
ar.reset_object_address(&p.first->first, &key);
|
||||
ar.reset_object_address(&p.first->first, &key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <boost/ptr_container/detail/serialize_xml_names.hpp>
|
||||
#include <boost/core/serialization.hpp>
|
||||
|
||||
namespace boost
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace ptr_container_detail
|
||||
@@ -25,8 +25,8 @@ void save_helper(Archive& ar, const ptr_container_detail::reversible_ptr_contain
|
||||
|
||||
const_iterator i = c.begin(), e = c.end();
|
||||
for(; i != e; ++i)
|
||||
ar << boost::serialization::make_nvp( ptr_container_detail::item(),
|
||||
ptr_container_detail::serialize_as_const(static_cast<value_type>(*i.base())));
|
||||
ar << boost::serialization::make_nvp( ptr_container_detail::item(),
|
||||
ptr_container_detail::serialize_as_const(static_cast<value_type>(*i.base())));
|
||||
}
|
||||
|
||||
template<class Archive, class Config, class CloneAllocator>
|
||||
@@ -41,7 +41,7 @@ void load_helper(Archive& ar, ptr_container_detail::reversible_ptr_container<Con
|
||||
// Called after an appropriate reserve on c.
|
||||
//
|
||||
|
||||
c.clear();
|
||||
c.clear();
|
||||
for(size_type i = 0u; i != n; ++i)
|
||||
{
|
||||
//
|
||||
@@ -49,20 +49,20 @@ void load_helper(Archive& ar, ptr_container_detail::reversible_ptr_container<Con
|
||||
// so we need not call ar.reset_object_address(v, u)
|
||||
//
|
||||
value_type ptr;
|
||||
ar >> boost::serialization::make_nvp( ptr_container_detail::item(), ptr );
|
||||
ar >> boost::serialization::make_nvp( ptr_container_detail::item(), ptr );
|
||||
c.insert(c.end(), ptr);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ptr_container_detail
|
||||
|
||||
namespace serialization
|
||||
namespace serialization
|
||||
{
|
||||
|
||||
template<class Archive, class Config, class CloneAllocator>
|
||||
void save(Archive& ar, const ptr_container_detail::reversible_ptr_container<Config, CloneAllocator>& c, unsigned int /*version*/)
|
||||
{
|
||||
ar << boost::serialization::make_nvp( ptr_container_detail::count(),
|
||||
{
|
||||
ar << boost::serialization::make_nvp( ptr_container_detail::count(),
|
||||
ptr_container_detail::serialize_as_const(c.size()) );
|
||||
ptr_container_detail::save_helper(ar, c);
|
||||
}
|
||||
@@ -72,11 +72,11 @@ void load(Archive& ar, ptr_container_detail::reversible_ptr_container<Config, Cl
|
||||
{
|
||||
typedef ptr_container_detail::reversible_ptr_container<Config, CloneAllocator> container_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME container_type::size_type size_type;
|
||||
|
||||
|
||||
size_type n;
|
||||
ar >> boost::serialization::make_nvp( ptr_container_detail::count(), n );
|
||||
ptr_container_detail::load_helper(ar, c, n);
|
||||
|
||||
|
||||
}
|
||||
|
||||
} // namespace serialization
|
||||
|
||||
@@ -4,25 +4,25 @@
|
||||
// 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.)
|
||||
|
||||
// Implementation of the move_ptr from the "Move Proposal"
|
||||
// (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2002/n1377.htm)
|
||||
// Implementation of the move_ptr from the "Move Proposal"
|
||||
// (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2002/n1377.htm)
|
||||
// enhanced to support custom deleters and safe boolean conversions.
|
||||
//
|
||||
// The implementation is based on an implementation by Daniel Wallin, at
|
||||
// "http://aspn.activestate.com/ASPN/Mail/Message/Attachments/boost/
|
||||
// 400DC271.1060903@student.umu.se/move_ptr.hpp". The current was adapted
|
||||
// by Jonathan Turkanis to incorporating ideas of Howard Hinnant and
|
||||
// Rani Sharoni.
|
||||
// 400DC271.1060903@student.umu.se/move_ptr.hpp". The current was adapted
|
||||
// by Jonathan Turkanis to incorporating ideas of Howard Hinnant and
|
||||
// Rani Sharoni.
|
||||
|
||||
#ifndef BOOST_STATIC_MOVE_PTR_HPP_INCLUDED
|
||||
#define BOOST_STATIC_MOVE_PTR_HPP_INCLUDED
|
||||
|
||||
#include <boost/config.hpp> // Member template friends, put size_t in std.
|
||||
#include <cstddef> // size_t
|
||||
#include <boost/compressed_pair.hpp>
|
||||
#include <boost/ptr_container/detail/default_deleter.hpp>
|
||||
#include <boost/ptr_container/detail/is_convertible.hpp>
|
||||
#include <boost/ptr_container/detail/move.hpp>
|
||||
#include <boost/compressed_pair.hpp>
|
||||
#include <boost/ptr_container/detail/default_deleter.hpp>
|
||||
#include <boost/ptr_container/detail/is_convertible.hpp>
|
||||
#include <boost/ptr_container/detail/move.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/type_traits/is_array.hpp>
|
||||
@@ -34,11 +34,11 @@
|
||||
|
||||
namespace boost { namespace ptr_container_detail {
|
||||
|
||||
|
||||
template< typename T,
|
||||
typename Deleter =
|
||||
|
||||
template< typename T,
|
||||
typename Deleter =
|
||||
move_ptrs::default_deleter<T> >
|
||||
class static_move_ptr
|
||||
class static_move_ptr
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
typedef Deleter deleter_type;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
struct safe_bool_helper { int x; };
|
||||
typedef int safe_bool_helper::* safe_bool;
|
||||
typedef boost::compressed_pair<element_type*, Deleter> impl_type;
|
||||
@@ -60,24 +60,24 @@ public:
|
||||
static_move_ptr() : impl_(0) { }
|
||||
|
||||
static_move_ptr(const static_move_ptr& p)
|
||||
: impl_(p.get(), p.get_deleter())
|
||||
{
|
||||
: impl_(p.get(), p.get_deleter())
|
||||
{
|
||||
const_cast<static_move_ptr&>(p).release();
|
||||
}
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
static_move_ptr( const move_ptrs::move_source<static_move_ptr<T,Deleter> >& src )
|
||||
#else
|
||||
static_move_ptr( const move_ptrs::move_source<static_move_ptr>& src )
|
||||
#endif
|
||||
#endif
|
||||
: impl_(src.ptr().get(), src.ptr().get_deleter())
|
||||
{
|
||||
src.ptr().release();
|
||||
}
|
||||
|
||||
|
||||
template<typename TT>
|
||||
static_move_ptr(TT* tt, Deleter del)
|
||||
: impl_(tt, del)
|
||||
static_move_ptr(TT* tt, Deleter del)
|
||||
: impl_(tt, del)
|
||||
{ }
|
||||
|
||||
// Destructor
|
||||
@@ -96,25 +96,25 @@ public:
|
||||
|
||||
element_type* get() const { return ptr(); }
|
||||
|
||||
element_type& operator*()
|
||||
{
|
||||
/*BOOST_STATIC_ASSERT(!is_array);*/ return *ptr();
|
||||
element_type& operator*()
|
||||
{
|
||||
/*BOOST_STATIC_ASSERT(!is_array);*/ return *ptr();
|
||||
}
|
||||
|
||||
const element_type& operator*() const
|
||||
{
|
||||
/*BOOST_STATIC_ASSERT(!is_array);*/ return *ptr();
|
||||
const element_type& operator*() const
|
||||
{
|
||||
/*BOOST_STATIC_ASSERT(!is_array);*/ return *ptr();
|
||||
}
|
||||
|
||||
element_type* operator->()
|
||||
{
|
||||
/*BOOST_STATIC_ASSERT(!is_array);*/ return ptr();
|
||||
}
|
||||
element_type* operator->()
|
||||
{
|
||||
/*BOOST_STATIC_ASSERT(!is_array);*/ return ptr();
|
||||
}
|
||||
|
||||
const element_type* operator->() const
|
||||
{
|
||||
/*BOOST_STATIC_ASSERT(!is_array);*/ return ptr();
|
||||
}
|
||||
const element_type* operator->() const
|
||||
{
|
||||
/*BOOST_STATIC_ASSERT(!is_array);*/ return ptr();
|
||||
}
|
||||
|
||||
|
||||
element_type* release()
|
||||
@@ -131,7 +131,7 @@ public:
|
||||
}
|
||||
|
||||
template<typename TT>
|
||||
void reset(TT* tt, Deleter dd)
|
||||
void reset(TT* tt, Deleter dd)
|
||||
{
|
||||
static_move_ptr(tt, dd).swap(*this);
|
||||
}
|
||||
@@ -149,31 +149,31 @@ private:
|
||||
{
|
||||
typedef move_ptrs::is_smart_ptr_convertible<TT, T> convertible;
|
||||
BOOST_STATIC_ASSERT(convertible::value);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) || defined(BOOST_NO_SFINAE)
|
||||
// give up on this behavior
|
||||
#else
|
||||
#else
|
||||
|
||||
template<typename Ptr> struct cant_move_from_const;
|
||||
|
||||
template<typename TT, typename DD>
|
||||
struct cant_move_from_const< const static_move_ptr<TT, DD> > {
|
||||
typedef typename static_move_ptr<TT, DD>::error type;
|
||||
template<typename TT, typename DD>
|
||||
struct cant_move_from_const< const static_move_ptr<TT, DD> > {
|
||||
typedef typename static_move_ptr<TT, DD>::error type;
|
||||
};
|
||||
|
||||
template<typename Ptr>
|
||||
template<typename Ptr>
|
||||
static_move_ptr(Ptr&, typename cant_move_from_const<Ptr>::type = 0);
|
||||
|
||||
|
||||
public:
|
||||
static_move_ptr(static_move_ptr&);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
template<typename TT, typename DD>
|
||||
static_move_ptr( static_move_ptr<TT, DD>&,
|
||||
typename
|
||||
typename
|
||||
move_ptrs::enable_if_convertible<
|
||||
TT, T, static_move_ptr&
|
||||
>::type::type* = 0 );
|
||||
@@ -186,10 +186,10 @@ private:
|
||||
//#else
|
||||
public:
|
||||
//#endif
|
||||
typename impl_type::first_reference
|
||||
ptr() { return impl_.first(); }
|
||||
typename impl_type::first_reference
|
||||
ptr() { return impl_.first(); }
|
||||
|
||||
typename impl_type::first_const_reference
|
||||
typename impl_type::first_const_reference
|
||||
ptr() const { return impl_.first(); }
|
||||
|
||||
impl_type impl_;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
#ifdef BOOST_PTR_CONTAINER_NO_EXCEPTIONS
|
||||
|
||||
#define BOOST_PTR_CONTAINER_THROW_EXCEPTION( If, Ex, Msg ) BOOST_ASSERT( !(If) && Msg )
|
||||
#define BOOST_PTR_CONTAINER_THROW_EXCEPTION( If, Ex, Msg ) BOOST_ASSERT( !(If) && Msg )
|
||||
|
||||
#else
|
||||
|
||||
|
||||
@@ -23,22 +23,22 @@
|
||||
namespace boost
|
||||
{
|
||||
template
|
||||
<
|
||||
class VoidIter,
|
||||
<
|
||||
class VoidIter,
|
||||
class T
|
||||
>
|
||||
class void_ptr_iterator
|
||||
{
|
||||
public:
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::remove_const<T>::type
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::remove_const<T>::type
|
||||
value_type;
|
||||
typedef T& reference;
|
||||
typedef T* pointer;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME iterator_difference<VoidIter>::type
|
||||
difference_type;
|
||||
difference_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME iterator_category<VoidIter>::type
|
||||
iterator_category;
|
||||
iterator_category;
|
||||
private:
|
||||
|
||||
VoidIter iter_;
|
||||
@@ -51,7 +51,7 @@ namespace boost
|
||||
{ }
|
||||
|
||||
//
|
||||
// Remark: passing by value breaks vc7.1
|
||||
// Remark: passing by value breaks vc7.1
|
||||
//
|
||||
template< class MutableIterator, class MutableT >
|
||||
void_ptr_iterator( const void_ptr_iterator<MutableIterator,MutableT>& r )
|
||||
@@ -72,7 +72,7 @@ namespace boost
|
||||
{
|
||||
return static_cast<T*>( *iter_ );
|
||||
}
|
||||
|
||||
|
||||
void_ptr_iterator& operator++()
|
||||
{
|
||||
++iter_;
|
||||
@@ -124,8 +124,8 @@ namespace boost
|
||||
}; // class 'void_ptr_iterator'
|
||||
|
||||
template< class VoidIter, class T >
|
||||
inline void_ptr_iterator<VoidIter,T>
|
||||
operator+( void_ptr_iterator<VoidIter,T> l,
|
||||
inline void_ptr_iterator<VoidIter,T>
|
||||
operator+( void_ptr_iterator<VoidIter,T> l,
|
||||
BOOST_DEDUCED_TYPENAME void_ptr_iterator<VoidIter,T>::difference_type n )
|
||||
{
|
||||
l += n;
|
||||
@@ -133,9 +133,9 @@ namespace boost
|
||||
}
|
||||
|
||||
template< class VoidIter, class T >
|
||||
inline void_ptr_iterator<VoidIter,T>
|
||||
operator+( BOOST_DEDUCED_TYPENAME void_ptr_iterator<VoidIter,T>::difference_type n,
|
||||
void_ptr_iterator<VoidIter,T> r )
|
||||
inline void_ptr_iterator<VoidIter,T>
|
||||
operator+( BOOST_DEDUCED_TYPENAME void_ptr_iterator<VoidIter,T>::difference_type n,
|
||||
void_ptr_iterator<VoidIter,T> r )
|
||||
|
||||
{
|
||||
r += n;
|
||||
@@ -143,8 +143,8 @@ namespace boost
|
||||
}
|
||||
|
||||
template< class VoidIter, class T >
|
||||
inline void_ptr_iterator<VoidIter,T>
|
||||
operator-( void_ptr_iterator<VoidIter,T> l,
|
||||
inline void_ptr_iterator<VoidIter,T>
|
||||
operator-( void_ptr_iterator<VoidIter,T> l,
|
||||
BOOST_DEDUCED_TYPENAME void_ptr_iterator<VoidIter,T>::difference_type n )
|
||||
{
|
||||
l -= n;
|
||||
@@ -152,9 +152,9 @@ namespace boost
|
||||
}
|
||||
|
||||
template< class VoidIter, class T >
|
||||
inline void_ptr_iterator<VoidIter,T>
|
||||
operator-( BOOST_DEDUCED_TYPENAME void_ptr_iterator<VoidIter,T>::difference_type n,
|
||||
void_ptr_iterator<VoidIter,T> r )
|
||||
inline void_ptr_iterator<VoidIter,T>
|
||||
operator-( BOOST_DEDUCED_TYPENAME void_ptr_iterator<VoidIter,T>::difference_type n,
|
||||
void_ptr_iterator<VoidIter,T> r )
|
||||
|
||||
{
|
||||
r -= n;
|
||||
@@ -171,14 +171,14 @@ namespace boost
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
template< class VoidIter, class T, class VoidIterU, class U >
|
||||
inline BOOST_DEDUCED_TYPENAME boost::enable_if<
|
||||
ptr_container_detail::is_compatible<T, U>,
|
||||
BOOST_DEDUCED_TYPENAME void_ptr_iterator<VoidIter,T>::difference_type
|
||||
>::type
|
||||
operator-( void_ptr_iterator<VoidIter,T> l,
|
||||
void_ptr_iterator<VoidIterU,U> r )
|
||||
void_ptr_iterator<VoidIterU,U> r )
|
||||
|
||||
{
|
||||
return l.base() - r.base();
|
||||
@@ -198,7 +198,7 @@ namespace boost
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
template< class VoidIterT, class T, class VoidIterU, class U >
|
||||
inline BOOST_DEDUCED_TYPENAME boost::enable_if<
|
||||
ptr_container_detail::is_compatible<T, U>,
|
||||
@@ -224,7 +224,7 @@ namespace boost
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
template< class VoidIterT, class T, class VoidIterU, class U >
|
||||
inline BOOST_DEDUCED_TYPENAME boost::enable_if<
|
||||
ptr_container_detail::is_compatible<T, U>,
|
||||
@@ -237,7 +237,7 @@ namespace boost
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
template< class VoidIterT, class T, class VoidIterU, class U >
|
||||
inline BOOST_DEDUCED_TYPENAME boost::enable_if<
|
||||
ptr_container_detail::is_compatible<T, U>,
|
||||
@@ -250,7 +250,7 @@ namespace boost
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
template< class VoidIterT, class T, class VoidIterU, class U >
|
||||
inline BOOST_DEDUCED_TYPENAME boost::enable_if<
|
||||
ptr_container_detail::is_compatible<T, U>,
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace boost
|
||||
public:
|
||||
bad_ptr_container_operation( const char* what ) : what_( what )
|
||||
{ }
|
||||
|
||||
|
||||
virtual const char* what() const throw()
|
||||
{
|
||||
return what_;
|
||||
@@ -34,7 +34,7 @@ namespace boost
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class bad_index : public bad_ptr_container_operation
|
||||
{
|
||||
public:
|
||||
@@ -49,7 +49,7 @@ namespace boost
|
||||
public:
|
||||
bad_pointer() : bad_ptr_container_operation( "Null pointer not allowed in a pointer container!" )
|
||||
{ }
|
||||
|
||||
|
||||
bad_pointer( const char* text ) : bad_ptr_container_operation( text )
|
||||
{ }
|
||||
};
|
||||
|
||||
@@ -41,13 +41,13 @@ namespace boost
|
||||
typedef typename Type::type type;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
<
|
||||
class Fun
|
||||
#ifdef BOOST_NO_SFINAE
|
||||
, class Result = bool
|
||||
#endif
|
||||
#endif
|
||||
>
|
||||
class indirect_fun
|
||||
{
|
||||
@@ -55,31 +55,31 @@ namespace boost
|
||||
public:
|
||||
indirect_fun() : fun(Fun())
|
||||
{ }
|
||||
|
||||
|
||||
indirect_fun( Fun f ) : fun(f)
|
||||
{ }
|
||||
|
||||
|
||||
template< class T >
|
||||
#ifdef BOOST_NO_SFINAE
|
||||
Result
|
||||
#else
|
||||
typename boost::result_of< const Fun( typename pointee<T>::type& ) >::type
|
||||
#endif
|
||||
Result
|
||||
#else
|
||||
typename boost::result_of< const Fun( typename pointee<T>::type& ) >::type
|
||||
#endif
|
||||
operator()( const T& r ) const
|
||||
{
|
||||
{
|
||||
return fun( *r );
|
||||
}
|
||||
|
||||
|
||||
template< class T, class U >
|
||||
#ifdef BOOST_NO_SFINAE
|
||||
Result
|
||||
#else
|
||||
Result
|
||||
#else
|
||||
typename boost::result_of< const Fun( typename pointee<T>::type&,
|
||||
typename pointee<U>::type& ) >::type
|
||||
#endif
|
||||
#endif
|
||||
operator()( const T& r, const U& r2 ) const
|
||||
{
|
||||
return fun( *r, *r2 );
|
||||
{
|
||||
return fun( *r, *r2 );
|
||||
}
|
||||
};
|
||||
|
||||
@@ -91,35 +91,35 @@ namespace boost
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
class Fun,
|
||||
class Arg1,
|
||||
class Arg2 = Arg1
|
||||
<
|
||||
class Fun,
|
||||
class Arg1,
|
||||
class Arg2 = Arg1
|
||||
#ifdef BOOST_NO_SFINAE
|
||||
, class Result = bool
|
||||
#endif
|
||||
, class Result = bool
|
||||
#endif
|
||||
>
|
||||
class void_ptr_indirect_fun
|
||||
{
|
||||
Fun fun;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
void_ptr_indirect_fun() : fun(Fun())
|
||||
{ }
|
||||
|
||||
void_ptr_indirect_fun( Fun f ) : fun(f)
|
||||
{ }
|
||||
|
||||
|
||||
template< class Void >
|
||||
#ifdef BOOST_NO_SFINAE
|
||||
Result
|
||||
#else
|
||||
Result
|
||||
#else
|
||||
typename ptr_container_detail::make_lazy<
|
||||
boost::result_of<const Fun(const Arg1&)>, Void>::type
|
||||
#endif
|
||||
#endif
|
||||
operator()( const Void* r ) const
|
||||
{
|
||||
{
|
||||
BOOST_STATIC_ASSERT(boost::is_void<Void>::value);
|
||||
BOOST_ASSERT( r != 0 );
|
||||
return fun( * static_cast<const Arg1*>( r ) );
|
||||
@@ -127,13 +127,13 @@ namespace boost
|
||||
|
||||
template< class Void >
|
||||
#ifdef BOOST_NO_SFINAE
|
||||
Result
|
||||
#else
|
||||
Result
|
||||
#else
|
||||
typename ptr_container_detail::make_lazy<
|
||||
boost::result_of<const Fun(const Arg1&, const Arg2&)>, Void>::type
|
||||
#endif
|
||||
#endif
|
||||
operator()( const Void* l, const Void* r ) const
|
||||
{
|
||||
{
|
||||
BOOST_STATIC_ASSERT(boost::is_void<Void>::value);
|
||||
BOOST_ASSERT( l != 0 && r != 0 );
|
||||
return fun( * static_cast<const Arg1*>( l ), * static_cast<const Arg2*>( r ) );
|
||||
@@ -145,7 +145,7 @@ namespace boost
|
||||
{
|
||||
return void_ptr_indirect_fun<Fun,Arg>( f );
|
||||
}
|
||||
|
||||
|
||||
} // namespace 'boost'
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,19 +25,19 @@
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
|
||||
template< class T >
|
||||
struct nullable
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
};
|
||||
|
||||
namespace ptr_container_detail
|
||||
{
|
||||
template< class T >
|
||||
type_traits::yes_type is_nullable( const nullable<T>* );
|
||||
|
||||
type_traits::no_type is_nullable( ... );
|
||||
type_traits::no_type is_nullable( ... );
|
||||
}
|
||||
|
||||
template< class T >
|
||||
@@ -47,19 +47,19 @@ namespace boost
|
||||
BOOST_STATIC_CONSTANT( T*, var );
|
||||
public:
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:6334)
|
||||
#endif
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:6334)
|
||||
#endif
|
||||
|
||||
BOOST_STATIC_CONSTANT(bool, value = sizeof( ptr_container_detail::is_nullable( var ) )
|
||||
BOOST_STATIC_CONSTANT(bool, value = sizeof( ptr_container_detail::is_nullable( var ) )
|
||||
== sizeof( type_traits::yes_type ) );
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
|
||||
template< class T >
|
||||
struct remove_nullable
|
||||
{
|
||||
@@ -74,10 +74,10 @@ namespace boost
|
||||
template< class T >
|
||||
struct void_ptr
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
mpl::if_c< boost::is_const<
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
mpl::if_c< boost::is_const<
|
||||
BOOST_DEDUCED_TYPENAME boost::remove_nullable<T>::type >::value,
|
||||
const void*, void* >::type type;
|
||||
const void*, void* >::type type;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,8 +95,8 @@ namespace boost
|
||||
{
|
||||
size_t i = 0;
|
||||
for( ; i != N; ++i )
|
||||
this->base()[i] = this->null_policy_allocate_clone(
|
||||
static_cast<const U*>( &r[i] ) );
|
||||
this->base()[i] = this->null_policy_allocate_clone(
|
||||
static_cast<const U*>( &r[i] ) );
|
||||
}
|
||||
|
||||
template< class U >
|
||||
@@ -104,8 +104,8 @@ namespace boost
|
||||
{
|
||||
size_t i = 0;
|
||||
for( ; i != N; ++i )
|
||||
this->base()[i] = this->null_policy_allocate_clone(
|
||||
static_cast<const T*>( &r[i] ) );
|
||||
this->base()[i] = this->null_policy_allocate_clone(
|
||||
static_cast<const T*>( &r[i] ) );
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
@@ -120,7 +120,7 @@ namespace boost
|
||||
ptr_array& operator=( ptr_array r )
|
||||
{
|
||||
this->swap( r );
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
@@ -195,9 +195,9 @@ namespace boost
|
||||
BOOST_STATIC_ASSERT( idx < N );
|
||||
|
||||
this->enforce_null_policy( r, "Null pointer in 'ptr_array::replace()'" );
|
||||
auto_type res( static_cast<U*>(this->base()[idx]), *this ); // nothrow
|
||||
auto_type res( static_cast<U*>(this->base()[idx]), *this ); // nothrow
|
||||
this->base()[idx] = r; // nothrow
|
||||
return boost::ptr_container::move(res); // nothrow
|
||||
return boost::ptr_container::move(res); // nothrow
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
@@ -225,7 +225,7 @@ namespace boost
|
||||
|
||||
auto_type res( static_cast<U*>(this->base()[idx]), *this ); // nothrow
|
||||
this->base()[idx] = ptr.release(); // nothrow
|
||||
return boost::ptr_container::move(res); // nothrow
|
||||
return boost::ptr_container::move(res); // nothrow
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
|
||||
@@ -30,25 +30,25 @@ namespace boost
|
||||
{
|
||||
|
||||
template
|
||||
<
|
||||
class T,
|
||||
<
|
||||
class T,
|
||||
class CloneAllocator = heap_clone_allocator,
|
||||
class Allocator = std::allocator<void*>
|
||||
>
|
||||
class ptr_circular_buffer : public
|
||||
class ptr_circular_buffer : public
|
||||
ptr_sequence_adapter< T, boost::circular_buffer<
|
||||
typename ptr_container_detail::void_ptr<T>::type,Allocator>,
|
||||
typename ptr_container_detail::void_ptr<T>::type,Allocator>,
|
||||
CloneAllocator >
|
||||
{
|
||||
{
|
||||
typedef ptr_sequence_adapter< T, boost::circular_buffer<
|
||||
typename ptr_container_detail::void_ptr<T>::type,Allocator>,
|
||||
CloneAllocator >
|
||||
typename ptr_container_detail::void_ptr<T>::type,Allocator>,
|
||||
CloneAllocator >
|
||||
base_type;
|
||||
|
||||
typedef boost::circular_buffer<typename
|
||||
typedef boost::circular_buffer<typename
|
||||
ptr_container_detail::void_ptr<T>::type,Allocator> circular_buffer_type;
|
||||
typedef ptr_circular_buffer<T,CloneAllocator,Allocator> this_type;
|
||||
|
||||
|
||||
public: // typedefs
|
||||
typedef typename base_type::value_type value_type;
|
||||
typedef value_type* pointer;
|
||||
@@ -58,7 +58,7 @@ namespace boost
|
||||
typedef typename base_type::iterator iterator;
|
||||
typedef typename base_type::const_iterator const_iterator;
|
||||
typedef typename base_type::auto_type auto_type;
|
||||
|
||||
|
||||
typedef std::pair<pointer,size_type> array_range;
|
||||
typedef std::pair<const_pointer,size_type> const_array_range;
|
||||
typedef typename circular_buffer_type::capacity_type capacity_type;
|
||||
@@ -70,7 +70,7 @@ namespace boost
|
||||
explicit ptr_circular_buffer( capacity_type n )
|
||||
: base_type( n, ptr_container_detail::fixed_length_sequence_tag() )
|
||||
{ }
|
||||
|
||||
|
||||
ptr_circular_buffer( capacity_type n,
|
||||
const allocator_type& alloc )
|
||||
: base_type( n, alloc, ptr_container_detail::fixed_length_sequence_tag() )
|
||||
@@ -87,13 +87,13 @@ namespace boost
|
||||
{ }
|
||||
|
||||
ptr_circular_buffer( const ptr_circular_buffer& r )
|
||||
: base_type( r.size(), r.begin(), r.end(),
|
||||
: base_type( r.size(), r.begin(), r.end(),
|
||||
ptr_container_detail::fixed_length_sequence_tag() )
|
||||
{ }
|
||||
|
||||
template< class U >
|
||||
ptr_circular_buffer( const ptr_circular_buffer<U>& r )
|
||||
: base_type( r.size(), r.begin(), r.end(),
|
||||
: base_type( r.size(), r.begin(), r.end(),
|
||||
ptr_container_detail::fixed_length_sequence_tag() )
|
||||
{ }
|
||||
|
||||
@@ -105,9 +105,9 @@ namespace boost
|
||||
|
||||
BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_circular_buffer,
|
||||
base_type, this_type )
|
||||
|
||||
|
||||
public: // allocators
|
||||
allocator_type& get_allocator()
|
||||
allocator_type& get_allocator()
|
||||
{
|
||||
return this->base().get_allocator();
|
||||
}
|
||||
@@ -181,7 +181,7 @@ namespace boost
|
||||
{
|
||||
if( this->size() > new_capacity )
|
||||
{
|
||||
this->erase( this->begin(),
|
||||
this->erase( this->begin(),
|
||||
this->begin() + (this->size()-new_capacity) );
|
||||
}
|
||||
this->base().rset_capacity( new_capacity );
|
||||
@@ -192,13 +192,13 @@ namespace boost
|
||||
size_type old_size = this->size();
|
||||
if( old_size > size )
|
||||
{
|
||||
this->erase( boost::next( this->begin(), size ), this->end() );
|
||||
this->erase( boost::next( this->begin(), size ), this->end() );
|
||||
}
|
||||
else if( size > old_size )
|
||||
{
|
||||
for( ; old_size != size; ++old_size )
|
||||
this->push_back( new BOOST_DEDUCED_TYPENAME
|
||||
boost::remove_pointer<value_type>::type() );
|
||||
this->push_back( new BOOST_DEDUCED_TYPENAME
|
||||
boost::remove_pointer<value_type>::type() );
|
||||
}
|
||||
|
||||
BOOST_ASSERT( this->size() == size );
|
||||
@@ -209,15 +209,15 @@ namespace boost
|
||||
size_type old_size = this->size();
|
||||
if( old_size > size )
|
||||
{
|
||||
this->erase( boost::next( this->begin(), size ), this->end() );
|
||||
this->erase( boost::next( this->begin(), size ), this->end() );
|
||||
}
|
||||
else if( size > old_size )
|
||||
{
|
||||
for( ; old_size != size; ++old_size )
|
||||
this->push_back( this->null_policy_allocate_clone( to_clone ) );
|
||||
this->push_back( this->null_policy_allocate_clone( to_clone ) );
|
||||
}
|
||||
|
||||
BOOST_ASSERT( this->size() == size );
|
||||
BOOST_ASSERT( this->size() == size );
|
||||
}
|
||||
|
||||
void rresize( size_type size ) // basic
|
||||
@@ -225,14 +225,14 @@ namespace boost
|
||||
size_type old_size = this->size();
|
||||
if( old_size > size )
|
||||
{
|
||||
this->erase( this->begin(),
|
||||
boost::next( this->begin(), old_size - size ) );
|
||||
this->erase( this->begin(),
|
||||
boost::next( this->begin(), old_size - size ) );
|
||||
}
|
||||
else if( size > old_size )
|
||||
{
|
||||
for( ; old_size != size; ++old_size )
|
||||
this->push_front( new BOOST_DEDUCED_TYPENAME
|
||||
boost::remove_pointer<value_type>::type() );
|
||||
this->push_front( new BOOST_DEDUCED_TYPENAME
|
||||
boost::remove_pointer<value_type>::type() );
|
||||
}
|
||||
|
||||
BOOST_ASSERT( this->size() == size );
|
||||
@@ -243,21 +243,21 @@ namespace boost
|
||||
size_type old_size = this->size();
|
||||
if( old_size > size )
|
||||
{
|
||||
this->erase( this->begin(),
|
||||
boost::next( this->begin(), old_size - size ) );
|
||||
this->erase( this->begin(),
|
||||
boost::next( this->begin(), old_size - size ) );
|
||||
}
|
||||
else if( size > old_size )
|
||||
{
|
||||
for( ; old_size != size; ++old_size )
|
||||
this->push_front( this->null_policy_allocate_clone( to_clone ) );
|
||||
this->push_front( this->null_policy_allocate_clone( to_clone ) );
|
||||
}
|
||||
|
||||
BOOST_ASSERT( this->size() == size );
|
||||
}
|
||||
}
|
||||
|
||||
template< class InputIterator >
|
||||
void assign( InputIterator first, InputIterator last ) // strong
|
||||
{
|
||||
{
|
||||
ptr_circular_buffer temp( first, last );
|
||||
this->swap( temp );
|
||||
}
|
||||
@@ -273,17 +273,17 @@ namespace boost
|
||||
ptr_circular_buffer temp( n );
|
||||
for( size_type i = 0u; i != n; ++i )
|
||||
temp.push_back( temp.null_policy_allocate_clone( to_clone ) );
|
||||
this->swap( temp );
|
||||
this->swap( temp );
|
||||
}
|
||||
|
||||
void assign( capacity_type capacity, size_type n,
|
||||
|
||||
void assign( capacity_type capacity, size_type n,
|
||||
value_type to_clone ) // basic
|
||||
{
|
||||
this->assign( (std::min)(n,capacity), to_clone );
|
||||
}
|
||||
|
||||
template< class InputIterator >
|
||||
void assign( capacity_type capacity,
|
||||
void assign( capacity_type capacity,
|
||||
InputIterator first, InputIterator last ) // basic
|
||||
{
|
||||
this->assign( first, last );
|
||||
@@ -294,11 +294,11 @@ namespace boost
|
||||
{
|
||||
BOOST_ASSERT( capacity() > 0 );
|
||||
this->enforce_null_policy( ptr, "Null pointer in 'push_back()'" );
|
||||
|
||||
|
||||
auto_type old_ptr( value_type(), *this );
|
||||
if( full() )
|
||||
old_ptr.reset( &*this->begin(), *this );
|
||||
this->base().push_back( ptr );
|
||||
this->base().push_back( ptr );
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
@@ -324,7 +324,7 @@ namespace boost
|
||||
auto_type old_ptr( value_type(), *this );
|
||||
if( full() )
|
||||
old_ptr.reset( &*(--this->end()), *this );
|
||||
this->base().push_front( ptr );
|
||||
this->base().push_front( ptr );
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
@@ -351,8 +351,8 @@ namespace boost
|
||||
iterator b = this->begin();
|
||||
if( full() && pos == b )
|
||||
return b;
|
||||
|
||||
new_ptr.release();
|
||||
|
||||
new_ptr.release();
|
||||
auto_type old_ptr( value_type(), *this );
|
||||
if( full() )
|
||||
old_ptr.reset( &*this->begin(), *this );
|
||||
@@ -379,7 +379,7 @@ namespace boost
|
||||
void insert( iterator pos, InputIterator first, InputIterator last ) // basic
|
||||
{
|
||||
for( ; first != last; ++first, ++pos )
|
||||
pos = insert( pos, this->null_policy_allocate_clone( &*first ) );
|
||||
pos = insert( pos, this->null_policy_allocate_clone( &*first ) );
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
@@ -393,7 +393,7 @@ namespace boost
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
iterator rinsert( iterator pos, value_type ptr ) // nothrow
|
||||
{
|
||||
BOOST_ASSERT( capacity() > 0 );
|
||||
@@ -403,8 +403,8 @@ namespace boost
|
||||
iterator b = this->end();
|
||||
if (full() && pos == b)
|
||||
return b;
|
||||
|
||||
new_ptr.release();
|
||||
|
||||
new_ptr.release();
|
||||
auto_type old_ptr( value_type(), *this );
|
||||
if( full() )
|
||||
old_ptr.reset( &this->back(), *this );
|
||||
@@ -427,12 +427,12 @@ namespace boost
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
template< class InputIterator >
|
||||
void rinsert( iterator pos, InputIterator first, InputIterator last ) // basic
|
||||
{
|
||||
for( ; first != last; ++first, ++pos )
|
||||
pos = rinsert( pos, this->null_policy_allocate_clone( &*first ) );
|
||||
pos = rinsert( pos, this->null_policy_allocate_clone( &*first ) );
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
@@ -474,37 +474,37 @@ namespace boost
|
||||
this->base().rotate( new_begin.base() );
|
||||
}
|
||||
|
||||
public: // transfer
|
||||
public: // transfer
|
||||
template< class PtrSeqAdapter >
|
||||
void transfer( iterator before,
|
||||
BOOST_DEDUCED_TYPENAME PtrSeqAdapter::iterator first,
|
||||
BOOST_DEDUCED_TYPENAME PtrSeqAdapter::iterator last,
|
||||
void transfer( iterator before,
|
||||
BOOST_DEDUCED_TYPENAME PtrSeqAdapter::iterator first,
|
||||
BOOST_DEDUCED_TYPENAME PtrSeqAdapter::iterator last,
|
||||
PtrSeqAdapter& from ) // nothrow
|
||||
{
|
||||
BOOST_ASSERT( (void*)&from != (void*)this );
|
||||
if( from.empty() )
|
||||
return;
|
||||
for( BOOST_DEDUCED_TYPENAME PtrSeqAdapter::iterator begin = first;
|
||||
for( BOOST_DEDUCED_TYPENAME PtrSeqAdapter::iterator begin = first;
|
||||
begin != last; ++begin, ++before )
|
||||
before = insert( before, &*begin ); // nothrow
|
||||
from.base().erase( first.base(), last.base() ); // nothrow
|
||||
}
|
||||
|
||||
template< class PtrSeqAdapter >
|
||||
void transfer( iterator before,
|
||||
BOOST_DEDUCED_TYPENAME PtrSeqAdapter::iterator object,
|
||||
void transfer( iterator before,
|
||||
BOOST_DEDUCED_TYPENAME PtrSeqAdapter::iterator object,
|
||||
PtrSeqAdapter& from ) // nothrow
|
||||
{
|
||||
BOOST_ASSERT( (void*)&from != (void*)this );
|
||||
if( from.empty() )
|
||||
return;
|
||||
insert( before, &*object ); // nothrow
|
||||
from.base().erase( object.base() ); // nothrow
|
||||
insert( before, &*object ); // nothrow
|
||||
from.base().erase( object.base() ); // nothrow
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
#else
|
||||
|
||||
|
||||
template< class PtrSeqAdapter, class Range >
|
||||
BOOST_DEDUCED_TYPENAME boost::disable_if< boost::is_same< Range,
|
||||
BOOST_DEDUCED_TYPENAME PtrSeqAdapter::iterator > >::type
|
||||
@@ -517,18 +517,18 @@ namespace boost
|
||||
template< class PtrSeqAdapter >
|
||||
void transfer( iterator before, PtrSeqAdapter& from ) // nothrow
|
||||
{
|
||||
transfer( before, from.begin(), from.end(), from );
|
||||
transfer( before, from.begin(), from.end(), from );
|
||||
}
|
||||
|
||||
public: // C-array support
|
||||
|
||||
void transfer( iterator before, value_type* from,
|
||||
size_type size, bool delete_from = true ) // nothrow
|
||||
|
||||
void transfer( iterator before, value_type* from,
|
||||
size_type size, bool delete_from = true ) // nothrow
|
||||
{
|
||||
BOOST_ASSERT( from != 0 );
|
||||
if( delete_from )
|
||||
{
|
||||
BOOST_DEDUCED_TYPENAME base_type::scoped_deleter
|
||||
BOOST_DEDUCED_TYPENAME base_type::scoped_deleter
|
||||
deleter( *this, from, size ); // nothrow
|
||||
for( size_type i = 0u; i != size; ++i, ++before )
|
||||
before = insert( before, *(from+i) ); // nothrow
|
||||
@@ -569,7 +569,7 @@ namespace boost
|
||||
{
|
||||
l.swap(r);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/ptr_container/
|
||||
//
|
||||
|
||||
|
||||
#ifndef BOOST_PTR_CONTAINER_HPP
|
||||
#define BOOST_PTR_CONTAINER_HPP
|
||||
|
||||
|
||||
@@ -27,25 +27,25 @@
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
class T,
|
||||
<
|
||||
class T,
|
||||
class CloneAllocator = heap_clone_allocator,
|
||||
class Allocator = std::allocator<typename ptr_container_detail::void_ptr<T>::type>
|
||||
>
|
||||
class ptr_deque : public
|
||||
class ptr_deque : public
|
||||
ptr_sequence_adapter< T, std::deque<
|
||||
typename ptr_container_detail::void_ptr<T>::type,Allocator>,
|
||||
CloneAllocator >
|
||||
{
|
||||
typedef ptr_sequence_adapter< T, std::deque<
|
||||
typename ptr_container_detail::void_ptr<T>::type,Allocator>,
|
||||
typename ptr_container_detail::void_ptr<T>::type,Allocator>,
|
||||
CloneAllocator >
|
||||
base_class;
|
||||
|
||||
typedef ptr_deque<T,CloneAllocator,Allocator> this_type;
|
||||
|
||||
typedef ptr_deque<T,CloneAllocator,Allocator> this_type;
|
||||
|
||||
public:
|
||||
|
||||
BOOST_PTR_CONTAINER_DEFINE_SEQEUENCE_MEMBERS( ptr_deque,
|
||||
@@ -55,7 +55,7 @@ namespace boost
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// clonability
|
||||
|
||||
|
||||
template< typename T, typename CA, typename A >
|
||||
inline ptr_deque<T,CA,A>* new_clone( const ptr_deque<T,CA,A>& r )
|
||||
{
|
||||
|
||||
@@ -35,25 +35,25 @@ namespace ptr_container
|
||||
|
||||
template< class PtrContainer >
|
||||
class ptr_front_insert_iterator;
|
||||
|
||||
|
||||
template< class PtrContainer >
|
||||
class ptr_insert_iterator;
|
||||
|
||||
template< class PtrContainer >
|
||||
ptr_back_insert_iterator<PtrContainer>
|
||||
ptr_back_insert_iterator<PtrContainer>
|
||||
ptr_back_inserter( PtrContainer& cont );
|
||||
|
||||
template< class PtrContainer >
|
||||
ptr_front_insert_iterator<PtrContainer>
|
||||
ptr_front_insert_iterator<PtrContainer>
|
||||
ptr_front_inserter( PtrContainer& cont );
|
||||
|
||||
template< class PtrContainer >
|
||||
ptr_insert_iterator<PtrContainer>
|
||||
ptr_insert_iterator<PtrContainer>
|
||||
ptr_inserter( PtrContainer& cont, typename PtrContainer::iterator before );
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Implementation
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
template< class PtrContainer >
|
||||
@@ -72,10 +72,10 @@ namespace ptr_container
|
||||
: container(&cont)
|
||||
{ }
|
||||
|
||||
ptr_back_insert_iterator&
|
||||
ptr_back_insert_iterator&
|
||||
operator=( typename PtrContainer::value_type r )
|
||||
{
|
||||
typename PtrContainer::value_type obj
|
||||
typename PtrContainer::value_type obj
|
||||
= container->null_policy_allocate_clone(r);
|
||||
container->push_back( obj );
|
||||
return *this;
|
||||
@@ -83,7 +83,7 @@ namespace ptr_container
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
template< class T >
|
||||
ptr_back_insert_iterator&
|
||||
ptr_back_insert_iterator&
|
||||
operator=( std::auto_ptr<T> r )
|
||||
{
|
||||
container->push_back( r );
|
||||
@@ -92,7 +92,7 @@ namespace ptr_container
|
||||
#endif
|
||||
#ifndef BOOST_NO_CXX11_SMART_PTR
|
||||
template< class T >
|
||||
ptr_back_insert_iterator&
|
||||
ptr_back_insert_iterator&
|
||||
operator=( std::unique_ptr<T> r )
|
||||
{
|
||||
container->push_back( std::move( r ) );
|
||||
@@ -100,7 +100,7 @@ namespace ptr_container
|
||||
}
|
||||
#endif
|
||||
|
||||
ptr_back_insert_iterator&
|
||||
ptr_back_insert_iterator&
|
||||
operator=( typename PtrContainer::const_reference r )
|
||||
{
|
||||
container->push_back( container->null_policy_allocate_clone(&r) );
|
||||
@@ -108,26 +108,26 @@ namespace ptr_container
|
||||
}
|
||||
|
||||
ptr_back_insert_iterator& operator*()
|
||||
{
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
ptr_back_insert_iterator& operator++()
|
||||
{
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
ptr_back_insert_iterator operator++(int)
|
||||
{
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
PtrContainer* container;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
template< class PtrContainer >
|
||||
class ptr_front_insert_iterator
|
||||
{
|
||||
@@ -144,10 +144,10 @@ namespace ptr_container
|
||||
: container(&cont)
|
||||
{ }
|
||||
|
||||
ptr_front_insert_iterator&
|
||||
ptr_front_insert_iterator&
|
||||
operator=( typename PtrContainer::value_type r )
|
||||
{
|
||||
typename PtrContainer::value_type obj
|
||||
typename PtrContainer::value_type obj
|
||||
= container->null_policy_allocate_clone(r);
|
||||
container->push_front( obj );
|
||||
return *this;
|
||||
@@ -155,7 +155,7 @@ namespace ptr_container
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
template< class T >
|
||||
ptr_front_insert_iterator&
|
||||
ptr_front_insert_iterator&
|
||||
operator=( std::auto_ptr<T> r )
|
||||
{
|
||||
container->push_front( r );
|
||||
@@ -164,15 +164,15 @@ namespace ptr_container
|
||||
#endif
|
||||
#ifndef BOOST_NO_CXX11_SMART_PTR
|
||||
template< class T >
|
||||
ptr_front_insert_iterator&
|
||||
ptr_front_insert_iterator&
|
||||
operator=( std::unique_ptr<T> r )
|
||||
{
|
||||
container->push_front( std::move( r ) );
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
ptr_front_insert_iterator&
|
||||
|
||||
ptr_front_insert_iterator&
|
||||
operator=( typename PtrContainer::const_reference r )
|
||||
{
|
||||
container->push_front( container->null_policy_allocate_clone(&r) );
|
||||
@@ -180,26 +180,26 @@ namespace ptr_container
|
||||
}
|
||||
|
||||
ptr_front_insert_iterator& operator*()
|
||||
{
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
ptr_front_insert_iterator& operator++()
|
||||
{
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
ptr_front_insert_iterator operator++(int)
|
||||
{
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
PtrContainer* container;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
template< class PtrContainer >
|
||||
class ptr_insert_iterator
|
||||
{
|
||||
@@ -217,10 +217,10 @@ namespace ptr_container
|
||||
: container(&cont), iter(before)
|
||||
{ }
|
||||
|
||||
ptr_insert_iterator&
|
||||
ptr_insert_iterator&
|
||||
operator=( typename PtrContainer::value_type r )
|
||||
{
|
||||
typename PtrContainer::value_type obj =
|
||||
typename PtrContainer::value_type obj =
|
||||
container->null_policy_allocate_clone(r);
|
||||
|
||||
iter = container->insert( iter, obj );
|
||||
@@ -229,7 +229,7 @@ namespace ptr_container
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
template< class T >
|
||||
ptr_insert_iterator&
|
||||
ptr_insert_iterator&
|
||||
operator=( std::auto_ptr<T> r )
|
||||
{
|
||||
iter = container->insert( iter, r );
|
||||
@@ -238,64 +238,64 @@ namespace ptr_container
|
||||
#endif
|
||||
#ifndef BOOST_NO_CXX11_SMART_PTR
|
||||
template< class T >
|
||||
ptr_insert_iterator&
|
||||
ptr_insert_iterator&
|
||||
operator=( std::unique_ptr<T> r )
|
||||
{
|
||||
iter = container->insert( iter, std::move( r ) );
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
ptr_insert_iterator&
|
||||
|
||||
ptr_insert_iterator&
|
||||
operator=( typename PtrContainer::const_reference r )
|
||||
{
|
||||
iter = container->insert( iter,
|
||||
iter = container->insert( iter,
|
||||
container->null_policy_allocate_clone(&r) );
|
||||
return *this;
|
||||
}
|
||||
|
||||
ptr_insert_iterator& operator*()
|
||||
{
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
ptr_insert_iterator& operator++()
|
||||
{
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
ptr_insert_iterator operator++(int)
|
||||
{
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
PtrContainer* container;
|
||||
typename PtrContainer::iterator iter;
|
||||
};
|
||||
|
||||
template< class PtrContainer >
|
||||
inline ptr_back_insert_iterator<PtrContainer>
|
||||
inline ptr_back_insert_iterator<PtrContainer>
|
||||
ptr_back_inserter( PtrContainer& cont )
|
||||
{
|
||||
return ptr_back_insert_iterator<PtrContainer>( cont );
|
||||
}
|
||||
|
||||
template< class PtrContainer >
|
||||
inline ptr_front_insert_iterator<PtrContainer>
|
||||
inline ptr_front_insert_iterator<PtrContainer>
|
||||
ptr_front_inserter( PtrContainer& cont )
|
||||
{
|
||||
return ptr_front_insert_iterator<PtrContainer>( cont );
|
||||
}
|
||||
|
||||
template< class PtrContainer >
|
||||
inline ptr_insert_iterator<PtrContainer>
|
||||
ptr_inserter( PtrContainer& cont,
|
||||
inline ptr_insert_iterator<PtrContainer>
|
||||
ptr_inserter( PtrContainer& cont,
|
||||
typename PtrContainer::iterator before )
|
||||
{
|
||||
return ptr_insert_iterator<PtrContainer>( cont, before );
|
||||
}
|
||||
|
||||
|
||||
} // namespace 'ptr_container'
|
||||
} // namespace 'boost'
|
||||
|
||||
|
||||
@@ -29,51 +29,51 @@ namespace boost
|
||||
{
|
||||
|
||||
template
|
||||
<
|
||||
class T,
|
||||
<
|
||||
class T,
|
||||
class CloneAllocator = heap_clone_allocator,
|
||||
class Allocator = std::allocator<typename ptr_container_detail::void_ptr<T>::type>
|
||||
>
|
||||
class ptr_list : public
|
||||
class ptr_list : public
|
||||
ptr_sequence_adapter< T, std::list<
|
||||
typename ptr_container_detail::void_ptr<T>::type,Allocator>,
|
||||
typename ptr_container_detail::void_ptr<T>::type,Allocator>,
|
||||
CloneAllocator >
|
||||
{
|
||||
typedef ptr_sequence_adapter< T, std::list<
|
||||
typename ptr_container_detail::void_ptr<T>::type,Allocator>,
|
||||
typename ptr_container_detail::void_ptr<T>::type,Allocator>,
|
||||
CloneAllocator >
|
||||
base_class;
|
||||
|
||||
typedef ptr_list<T,CloneAllocator,Allocator> this_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::remove_nullable<T>::type U;
|
||||
|
||||
|
||||
public:
|
||||
BOOST_PTR_CONTAINER_DEFINE_SEQEUENCE_MEMBERS( ptr_list,
|
||||
BOOST_PTR_CONTAINER_DEFINE_SEQEUENCE_MEMBERS( ptr_list,
|
||||
base_class,
|
||||
this_type )
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME base_class::value_type value_type;
|
||||
|
||||
|
||||
public:
|
||||
using base_class::merge;
|
||||
|
||||
void merge( ptr_list& x )
|
||||
|
||||
void merge( ptr_list& x )
|
||||
{
|
||||
merge( x, std::less<U>() );
|
||||
}
|
||||
|
||||
template< typename Compare >
|
||||
void merge( ptr_list& x, Compare comp )
|
||||
template< typename Compare >
|
||||
void merge( ptr_list& x, Compare comp )
|
||||
{
|
||||
this->base().merge( x.base(), void_ptr_indirect_fun<Compare,U>( comp ) ); }
|
||||
|
||||
void sort()
|
||||
{
|
||||
sort( std::less<U>() );
|
||||
void sort()
|
||||
{
|
||||
sort( std::less<U>() );
|
||||
};
|
||||
|
||||
template< typename Compare >
|
||||
void sort( Compare comp )
|
||||
template< typename Compare >
|
||||
void sort( Compare comp )
|
||||
{
|
||||
this->base().sort( void_ptr_indirect_fun<Compare,U>( comp ) );
|
||||
}
|
||||
@@ -83,14 +83,14 @@ namespace boost
|
||||
{
|
||||
base_class::erase_if( first, last, pred );
|
||||
}
|
||||
|
||||
|
||||
template< class Pred >
|
||||
void erase_if( Pred pred )
|
||||
{
|
||||
this->base().remove_if( BOOST_DEDUCED_TYPENAME base_class::
|
||||
this->base().remove_if( BOOST_DEDUCED_TYPENAME base_class::
|
||||
BOOST_NESTED_TEMPLATE void_ptr_delete_if<Pred,value_type>
|
||||
(pred) );
|
||||
}
|
||||
}
|
||||
|
||||
}; // class 'ptr_list'
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace boost
|
||||
{
|
||||
return r.clone().release();
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// swap
|
||||
|
||||
|
||||
@@ -27,16 +27,16 @@
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
class Key,
|
||||
class T,
|
||||
<
|
||||
class Key,
|
||||
class T,
|
||||
class Compare = std::less<Key>,
|
||||
class CloneAllocator = heap_clone_allocator,
|
||||
class Allocator = std::allocator< std::pair<const Key,typename ptr_container_detail::void_ptr<T>::type> >
|
||||
>
|
||||
class ptr_map :
|
||||
class ptr_map :
|
||||
public ptr_map_adapter<T,std::map<Key,
|
||||
typename ptr_container_detail::void_ptr<T>::type,
|
||||
Compare,Allocator>,CloneAllocator>
|
||||
@@ -47,28 +47,28 @@ namespace boost
|
||||
base_type;
|
||||
|
||||
typedef ptr_map<Key,T,Compare,CloneAllocator,Allocator> this_type;
|
||||
|
||||
|
||||
public:
|
||||
ptr_map()
|
||||
{ }
|
||||
|
||||
|
||||
explicit ptr_map( const Compare& comp,
|
||||
const Allocator& a = Allocator() )
|
||||
const Allocator& a = Allocator() )
|
||||
: base_type( comp, a ) { }
|
||||
|
||||
template< class InputIterator >
|
||||
ptr_map( InputIterator first, InputIterator last )
|
||||
: base_type( first, last )
|
||||
{ }
|
||||
|
||||
|
||||
template< class InputIterator >
|
||||
ptr_map( InputIterator first, InputIterator last,
|
||||
ptr_map( InputIterator first, InputIterator last,
|
||||
const Compare& comp,
|
||||
const Allocator& a = Allocator() )
|
||||
: base_type( first, last, comp, a )
|
||||
: base_type( first, last, comp, a )
|
||||
{ }
|
||||
|
||||
BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_map, base_type,
|
||||
BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_map, base_type,
|
||||
this_type )
|
||||
|
||||
template< class U >
|
||||
@@ -81,18 +81,18 @@ namespace boost
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
class Key,
|
||||
class T,
|
||||
class Compare = std::less<Key>,
|
||||
<
|
||||
class Key,
|
||||
class T,
|
||||
class Compare = std::less<Key>,
|
||||
class CloneAllocator = heap_clone_allocator,
|
||||
class Allocator = std::allocator< std::pair<const Key,void*> >
|
||||
>
|
||||
class ptr_multimap :
|
||||
class ptr_multimap :
|
||||
public ptr_multimap_adapter<T,std::multimap<Key,void*,
|
||||
Compare,Allocator>,CloneAllocator>
|
||||
{
|
||||
@@ -101,28 +101,28 @@ namespace boost
|
||||
base_type;
|
||||
|
||||
typedef ptr_multimap<Key,T,Compare,CloneAllocator,Allocator> this_type;
|
||||
|
||||
|
||||
public:
|
||||
ptr_multimap()
|
||||
{ }
|
||||
|
||||
|
||||
explicit ptr_multimap( const Compare& comp,
|
||||
const Allocator& a = Allocator() )
|
||||
const Allocator& a = Allocator() )
|
||||
: base_type( comp, a ) { }
|
||||
|
||||
template< class InputIterator >
|
||||
ptr_multimap( InputIterator first, InputIterator last )
|
||||
: base_type( first, last )
|
||||
{ }
|
||||
|
||||
|
||||
template< class InputIterator >
|
||||
ptr_multimap( InputIterator first, InputIterator last,
|
||||
const Compare& comp,
|
||||
const Allocator& a = Allocator() )
|
||||
: base_type( first, last, comp, a )
|
||||
: base_type( first, last, comp, a )
|
||||
{ }
|
||||
|
||||
BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_multimap,
|
||||
BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_multimap,
|
||||
base_type,
|
||||
this_type )
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace ptr_container_detail
|
||||
{
|
||||
|
||||
template
|
||||
<
|
||||
<
|
||||
class T,
|
||||
class VoidPtrMap,
|
||||
bool Ordered
|
||||
@@ -43,69 +43,69 @@ namespace ptr_container_detail
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME remove_nullable<T>::type
|
||||
U;
|
||||
typedef VoidPtrMap
|
||||
typedef VoidPtrMap
|
||||
void_container_type;
|
||||
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME VoidPtrMap::allocator_type
|
||||
allocator_type;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
mpl::eval_if_c<Ordered,
|
||||
select_value_compare<VoidPtrMap>,
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
mpl::eval_if_c<Ordered,
|
||||
select_value_compare<VoidPtrMap>,
|
||||
mpl::identity<void> >::type
|
||||
value_compare;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
mpl::eval_if_c<Ordered,
|
||||
select_key_compare<VoidPtrMap>,
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
mpl::eval_if_c<Ordered,
|
||||
select_key_compare<VoidPtrMap>,
|
||||
mpl::identity<void> >::type
|
||||
key_compare;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
mpl::eval_if_c<Ordered,
|
||||
mpl::identity<void>,
|
||||
select_hasher<VoidPtrMap> >::type
|
||||
hasher;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
mpl::eval_if_c<Ordered,
|
||||
mpl::identity<void>,
|
||||
select_key_equal<VoidPtrMap> >::type
|
||||
key_equal;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
mpl::if_c<Ordered,
|
||||
ptr_container_detail::ordered_associative_container_tag,
|
||||
ptr_container_detail::unordered_associative_container_tag>::type
|
||||
container_type;
|
||||
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME VoidPtrMap::key_type
|
||||
key_type;
|
||||
|
||||
|
||||
typedef U value_type;
|
||||
|
||||
typedef ptr_map_iterator< BOOST_DEDUCED_TYPENAME VoidPtrMap::iterator, key_type, U* const >
|
||||
iterator;
|
||||
|
||||
|
||||
typedef ptr_map_iterator< BOOST_DEDUCED_TYPENAME VoidPtrMap::const_iterator, key_type, const U* const>
|
||||
const_iterator;
|
||||
|
||||
|
||||
typedef ptr_map_iterator<
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
mpl::eval_if_c<Ordered,
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
mpl::eval_if_c<Ordered,
|
||||
select_iterator<VoidPtrMap>,
|
||||
select_local_iterator<VoidPtrMap> >::type,
|
||||
key_type, U* const >
|
||||
local_iterator;
|
||||
|
||||
typedef ptr_map_iterator<
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
mpl::eval_if_c<Ordered,
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
mpl::eval_if_c<Ordered,
|
||||
select_iterator<VoidPtrMap>,
|
||||
select_const_local_iterator<VoidPtrMap> >::type,
|
||||
key_type, const U* const >
|
||||
const_local_iterator;
|
||||
|
||||
const_local_iterator;
|
||||
|
||||
template< class Iter >
|
||||
static U* get_pointer( Iter i )
|
||||
{
|
||||
@@ -120,27 +120,27 @@ namespace ptr_container_detail
|
||||
|
||||
BOOST_STATIC_CONSTANT( bool, allow_null = boost::is_nullable<T>::value );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
<
|
||||
class T,
|
||||
class VoidPtrMap,
|
||||
class VoidPtrMap,
|
||||
class CloneAllocator,
|
||||
bool Ordered
|
||||
>
|
||||
class ptr_map_adapter_base :
|
||||
class ptr_map_adapter_base :
|
||||
public ptr_container_detail::associative_ptr_container< map_config<T,VoidPtrMap,Ordered>,
|
||||
CloneAllocator >
|
||||
{
|
||||
typedef ptr_container_detail::associative_ptr_container< map_config<T,VoidPtrMap,Ordered>,
|
||||
CloneAllocator >
|
||||
CloneAllocator >
|
||||
base_type;
|
||||
|
||||
typedef map_config<T,VoidPtrMap,Ordered> config;
|
||||
typedef ptr_map_adapter_base<T,VoidPtrMap,CloneAllocator,Ordered> this_type;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::allocator_type
|
||||
@@ -155,7 +155,7 @@ namespace ptr_container_detail
|
||||
key_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::auto_type
|
||||
auto_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::value_type
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::value_type
|
||||
mapped_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::reference
|
||||
mapped_reference;
|
||||
@@ -167,9 +167,9 @@ namespace ptr_container_detail
|
||||
reference;
|
||||
typedef BOOST_DEDUCED_TYPENAME iterator_value<const_iterator>::type
|
||||
const_reference;
|
||||
typedef value_type
|
||||
typedef value_type
|
||||
pointer;
|
||||
typedef const_reference
|
||||
typedef const_reference
|
||||
const_pointer;
|
||||
|
||||
private:
|
||||
@@ -188,11 +188,11 @@ namespace ptr_container_detail
|
||||
VoidPtrMap* m_;
|
||||
const key_type& key_;
|
||||
|
||||
eraser( VoidPtrMap* m, const key_type& key )
|
||||
eraser( VoidPtrMap* m, const key_type& key )
|
||||
: released_(false), m_(m), key_(key)
|
||||
{}
|
||||
|
||||
~eraser()
|
||||
~eraser()
|
||||
{
|
||||
if( !released_ )
|
||||
m_->erase(key_);
|
||||
@@ -200,8 +200,8 @@ namespace ptr_container_detail
|
||||
|
||||
void release() { released_ = true; }
|
||||
|
||||
private:
|
||||
eraser& operator=(const eraser&);
|
||||
private:
|
||||
eraser& operator=(const eraser&);
|
||||
};
|
||||
|
||||
mapped_reference insert_lookup( const key_type& key )
|
||||
@@ -214,28 +214,28 @@ namespace ptr_container_detail
|
||||
else
|
||||
{
|
||||
eraser e(&this->base(),key); // nothrow
|
||||
mapped_type res = new T(); // strong
|
||||
mapped_type res = new T(); // strong
|
||||
ref = res; // nothrow
|
||||
e.release(); // nothrow
|
||||
return *res;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
|
||||
ptr_map_adapter_base()
|
||||
{ }
|
||||
|
||||
template< class SizeType >
|
||||
explicit ptr_map_adapter_base( SizeType n,
|
||||
explicit ptr_map_adapter_base( SizeType n,
|
||||
ptr_container_detail::unordered_associative_container_tag tag )
|
||||
: base_type( n, tag )
|
||||
{ }
|
||||
|
||||
template< class Compare, class Allocator >
|
||||
ptr_map_adapter_base( const Compare& comp,
|
||||
const Allocator& a )
|
||||
: base_type( comp, a )
|
||||
const Allocator& a )
|
||||
: base_type( comp, a )
|
||||
{ }
|
||||
|
||||
template< class Hash, class Pred, class Allocator >
|
||||
@@ -244,12 +244,12 @@ namespace ptr_container_detail
|
||||
const Allocator& a )
|
||||
: base_type( hash, pred, a )
|
||||
{ }
|
||||
|
||||
|
||||
template< class InputIterator >
|
||||
ptr_map_adapter_base( InputIterator first, InputIterator last )
|
||||
: base_type( first, last )
|
||||
{ }
|
||||
|
||||
|
||||
template< class InputIterator, class Comp >
|
||||
ptr_map_adapter_base( InputIterator first, InputIterator last,
|
||||
const Comp& comp,
|
||||
@@ -264,7 +264,7 @@ namespace ptr_container_detail
|
||||
const Allocator& a )
|
||||
: base_type( first, last, hash, pred, a )
|
||||
{ }
|
||||
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
template< class PtrContainer >
|
||||
explicit ptr_map_adapter_base( std::auto_ptr<PtrContainer> clone )
|
||||
@@ -276,7 +276,7 @@ namespace ptr_container_detail
|
||||
{
|
||||
base_type::operator=( clone );
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifndef BOOST_NO_CXX11_SMART_PTR
|
||||
template< class PtrContainer >
|
||||
@@ -292,75 +292,75 @@ namespace ptr_container_detail
|
||||
}
|
||||
#endif
|
||||
|
||||
iterator find( const key_type& x )
|
||||
{
|
||||
return iterator( this->base().find( x ) );
|
||||
}
|
||||
iterator find( const key_type& x )
|
||||
{
|
||||
return iterator( this->base().find( x ) );
|
||||
}
|
||||
|
||||
const_iterator find( const key_type& x ) const
|
||||
{
|
||||
return const_iterator( this->base().find( x ) );
|
||||
}
|
||||
const_iterator find( const key_type& x ) const
|
||||
{
|
||||
return const_iterator( this->base().find( x ) );
|
||||
}
|
||||
|
||||
size_type count( const key_type& x ) const
|
||||
{
|
||||
return this->base().count( x );
|
||||
}
|
||||
|
||||
iterator lower_bound( const key_type& x )
|
||||
{
|
||||
return iterator( this->base().lower_bound( x ) );
|
||||
}
|
||||
|
||||
const_iterator lower_bound( const key_type& x ) const
|
||||
{
|
||||
return const_iterator( this->base().lower_bound( x ) );
|
||||
}
|
||||
|
||||
iterator upper_bound( const key_type& x )
|
||||
{
|
||||
return iterator( this->base().upper_bound( x ) );
|
||||
}
|
||||
|
||||
const_iterator upper_bound( const key_type& x ) const
|
||||
{
|
||||
return const_iterator( this->base().upper_bound( x ) );
|
||||
}
|
||||
|
||||
iterator_range<iterator> equal_range( const key_type& x )
|
||||
{
|
||||
size_type count( const key_type& x ) const
|
||||
{
|
||||
return this->base().count( x );
|
||||
}
|
||||
|
||||
iterator lower_bound( const key_type& x )
|
||||
{
|
||||
return iterator( this->base().lower_bound( x ) );
|
||||
}
|
||||
|
||||
const_iterator lower_bound( const key_type& x ) const
|
||||
{
|
||||
return const_iterator( this->base().lower_bound( x ) );
|
||||
}
|
||||
|
||||
iterator upper_bound( const key_type& x )
|
||||
{
|
||||
return iterator( this->base().upper_bound( x ) );
|
||||
}
|
||||
|
||||
const_iterator upper_bound( const key_type& x ) const
|
||||
{
|
||||
return const_iterator( this->base().upper_bound( x ) );
|
||||
}
|
||||
|
||||
iterator_range<iterator> equal_range( const key_type& x )
|
||||
{
|
||||
std::pair<BOOST_DEDUCED_TYPENAME base_type::ptr_iterator,
|
||||
BOOST_DEDUCED_TYPENAME base_type::ptr_iterator>
|
||||
p = this->base().equal_range( x );
|
||||
return make_iterator_range( iterator( p.first ), iterator( p.second ) );
|
||||
}
|
||||
|
||||
iterator_range<const_iterator> equal_range( const key_type& x ) const
|
||||
{
|
||||
std::pair<BOOST_DEDUCED_TYPENAME base_type::ptr_const_iterator,
|
||||
BOOST_DEDUCED_TYPENAME base_type::ptr_const_iterator>
|
||||
p = this->base().equal_range( x );
|
||||
return make_iterator_range( const_iterator( p.first ),
|
||||
const_iterator( p.second ) );
|
||||
}
|
||||
|
||||
mapped_reference at( const key_type& key )
|
||||
{
|
||||
return const_cast<mapped_reference>( lookup( key ) );
|
||||
p = this->base().equal_range( x );
|
||||
return make_iterator_range( iterator( p.first ), iterator( p.second ) );
|
||||
}
|
||||
|
||||
|
||||
iterator_range<const_iterator> equal_range( const key_type& x ) const
|
||||
{
|
||||
std::pair<BOOST_DEDUCED_TYPENAME base_type::ptr_const_iterator,
|
||||
BOOST_DEDUCED_TYPENAME base_type::ptr_const_iterator>
|
||||
p = this->base().equal_range( x );
|
||||
return make_iterator_range( const_iterator( p.first ),
|
||||
const_iterator( p.second ) );
|
||||
}
|
||||
|
||||
mapped_reference at( const key_type& key )
|
||||
{
|
||||
return const_cast<mapped_reference>( lookup( key ) );
|
||||
}
|
||||
|
||||
const_mapped_reference at( const key_type& key ) const
|
||||
{
|
||||
{
|
||||
return lookup( key );
|
||||
}
|
||||
|
||||
mapped_reference operator[]( const key_type& key )
|
||||
{
|
||||
return insert_lookup( key );
|
||||
}
|
||||
}
|
||||
|
||||
auto_type replace( iterator where, mapped_type x ) // strong
|
||||
{
|
||||
auto_type replace( iterator where, mapped_type x ) // strong
|
||||
{
|
||||
BOOST_ASSERT( where != this->end() );
|
||||
this->enforce_null_policy( x, "Null pointer in 'replace()'" );
|
||||
|
||||
@@ -395,29 +395,29 @@ namespace ptr_container_detail
|
||||
return this->base().bucket( key );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
} // ptr_container_detail
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// ptr_map_adapter
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
<
|
||||
class T,
|
||||
class VoidPtrMap,
|
||||
class VoidPtrMap,
|
||||
class CloneAllocator = heap_clone_allocator,
|
||||
bool Ordered = true
|
||||
>
|
||||
class ptr_map_adapter :
|
||||
class ptr_map_adapter :
|
||||
public ptr_container_detail::ptr_map_adapter_base<T,VoidPtrMap,CloneAllocator,Ordered>
|
||||
{
|
||||
typedef ptr_container_detail::ptr_map_adapter_base<T,VoidPtrMap,CloneAllocator,Ordered>
|
||||
typedef ptr_container_detail::ptr_map_adapter_base<T,VoidPtrMap,CloneAllocator,Ordered>
|
||||
base_type;
|
||||
|
||||
public:
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::iterator
|
||||
iterator;
|
||||
|
||||
public:
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::iterator
|
||||
iterator;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::const_iterator
|
||||
const_iterator;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::size_type
|
||||
@@ -428,7 +428,7 @@ namespace ptr_container_detail
|
||||
const_reference;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::auto_type
|
||||
auto_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME VoidPtrMap::allocator_type
|
||||
typedef BOOST_DEDUCED_TYPENAME VoidPtrMap::allocator_type
|
||||
allocator_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::mapped_type
|
||||
mapped_type;
|
||||
@@ -437,42 +437,42 @@ namespace ptr_container_detail
|
||||
void safe_insert( const key_type& key, auto_type ptr ) // strong
|
||||
{
|
||||
std::pair<BOOST_DEDUCED_TYPENAME base_type::ptr_iterator,bool>
|
||||
res =
|
||||
this->base().insert( std::make_pair( key, ptr.get() ) ); // strong, commit
|
||||
if( res.second ) // nothrow
|
||||
res =
|
||||
this->base().insert( std::make_pair( key, ptr.get() ) ); // strong, commit
|
||||
if( res.second ) // nothrow
|
||||
ptr.release(); // nothrow
|
||||
}
|
||||
|
||||
template< class II >
|
||||
void map_basic_clone_and_insert( II first, II last )
|
||||
{
|
||||
while( first != last )
|
||||
{
|
||||
template< class II >
|
||||
void map_basic_clone_and_insert( II first, II last )
|
||||
{
|
||||
while( first != last )
|
||||
{
|
||||
if( this->find( first->first ) == this->end() )
|
||||
{
|
||||
const_reference p = *first.base(); // nothrow
|
||||
auto_type ptr( this->null_policy_allocate_clone(p.second), *this );
|
||||
// strong
|
||||
this->safe_insert( p.first,
|
||||
const_reference p = *first.base(); // nothrow
|
||||
auto_type ptr( this->null_policy_allocate_clone(p.second), *this );
|
||||
// strong
|
||||
this->safe_insert( p.first,
|
||||
boost::ptr_container::move( ptr ) );
|
||||
// strong, commit
|
||||
// strong, commit
|
||||
}
|
||||
++first;
|
||||
}
|
||||
++first;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
ptr_map_adapter( )
|
||||
{ }
|
||||
|
||||
template< class Comp >
|
||||
explicit ptr_map_adapter( const Comp& comp,
|
||||
const allocator_type& a )
|
||||
const allocator_type& a )
|
||||
: base_type( comp, a ) { }
|
||||
|
||||
template< class SizeType >
|
||||
explicit ptr_map_adapter( SizeType n,
|
||||
ptr_container_detail::unordered_associative_container_tag tag )
|
||||
ptr_container_detail::unordered_associative_container_tag tag )
|
||||
: base_type( n, tag ) { }
|
||||
|
||||
template< class Hash, class Pred, class Allocator >
|
||||
@@ -481,18 +481,18 @@ namespace ptr_container_detail
|
||||
const Allocator& a )
|
||||
: base_type( hash, pred, a )
|
||||
{ }
|
||||
|
||||
|
||||
template< class InputIterator >
|
||||
ptr_map_adapter( InputIterator first, InputIterator last )
|
||||
{
|
||||
map_basic_clone_and_insert( first, last );
|
||||
map_basic_clone_and_insert( first, last );
|
||||
}
|
||||
|
||||
|
||||
template< class InputIterator, class Comp >
|
||||
ptr_map_adapter( InputIterator first, InputIterator last,
|
||||
ptr_map_adapter( InputIterator first, InputIterator last,
|
||||
const Comp& comp,
|
||||
const allocator_type& a = allocator_type() )
|
||||
: base_type( comp, a )
|
||||
: base_type( comp, a )
|
||||
{
|
||||
map_basic_clone_and_insert( first, last );
|
||||
}
|
||||
@@ -504,20 +504,20 @@ namespace ptr_container_detail
|
||||
const Allocator& a )
|
||||
: base_type( hash, pred, a )
|
||||
{
|
||||
map_basic_clone_and_insert( first, last );
|
||||
map_basic_clone_and_insert( first, last );
|
||||
}
|
||||
|
||||
|
||||
ptr_map_adapter( const ptr_map_adapter& r )
|
||||
{
|
||||
map_basic_clone_and_insert( r.begin(), r.end() );
|
||||
map_basic_clone_and_insert( r.begin(), r.end() );
|
||||
}
|
||||
|
||||
|
||||
template< class Key, class U, class CA, bool b >
|
||||
ptr_map_adapter( const ptr_map_adapter<Key,U,CA,b>& r )
|
||||
{
|
||||
map_basic_clone_and_insert( r.begin(), r.end() );
|
||||
map_basic_clone_and_insert( r.begin(), r.end() );
|
||||
}
|
||||
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
template< class U >
|
||||
ptr_map_adapter( std::auto_ptr<U> r ) : base_type( r )
|
||||
@@ -573,27 +573,27 @@ namespace ptr_container_detail
|
||||
|
||||
auto_type ptr( x, *this ); // nothrow
|
||||
std::pair<BOOST_DEDUCED_TYPENAME base_type::ptr_iterator,bool>
|
||||
res = this->base().insert( std::make_pair( key, x ) ); // strong, commit
|
||||
if( res.second ) // nothrow
|
||||
res = this->base().insert( std::make_pair( key, x ) ); // strong, commit
|
||||
if( res.second ) // nothrow
|
||||
ptr.release(); // nothrow
|
||||
return std::make_pair( iterator( res.first ), res.second ); // nothrow
|
||||
return std::make_pair( iterator( res.first ), res.second ); // nothrow
|
||||
}
|
||||
|
||||
iterator insert_impl( iterator before, const key_type& key, mapped_type x ) // strong
|
||||
{
|
||||
this->enforce_null_policy( x,
|
||||
this->enforce_null_policy( x,
|
||||
"Null pointer in 'ptr_map_adapter::insert()'" );
|
||||
|
||||
|
||||
auto_type ptr( x, *this ); // nothrow
|
||||
BOOST_DEDUCED_TYPENAME base_type::ptr_iterator
|
||||
res = this->base().insert( before.base(), std::make_pair( key, x ) );
|
||||
// strong, commit
|
||||
// strong, commit
|
||||
ptr.release(); // notrow
|
||||
return iterator( res );
|
||||
return iterator( res );
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
std::pair<iterator,bool> insert( key_type& key, mapped_type x )
|
||||
{
|
||||
return insert_impl( key, x );
|
||||
@@ -617,16 +617,16 @@ namespace ptr_container_detail
|
||||
template< class F, class S >
|
||||
iterator insert( iterator before, ptr_container_detail::ref_pair<F,S> p ) // strong
|
||||
{
|
||||
this->enforce_null_policy( p.second,
|
||||
this->enforce_null_policy( p.second,
|
||||
"Null pointer in 'ptr_map_adapter::insert()'" );
|
||||
|
||||
auto_type ptr( this->null_policy_allocate_clone(p.second), *this );
|
||||
|
||||
auto_type ptr( this->null_policy_allocate_clone(p.second), *this );
|
||||
BOOST_DEDUCED_TYPENAME base_type::ptr_iterator
|
||||
result = this->base().insert( before.base(),
|
||||
result = this->base().insert( before.base(),
|
||||
std::make_pair(p.first,ptr.get()) ); // strong
|
||||
if( ptr.get() == result->second )
|
||||
ptr.release();
|
||||
|
||||
|
||||
return iterator( result );
|
||||
}
|
||||
|
||||
@@ -649,24 +649,24 @@ namespace ptr_container_detail
|
||||
return insert_impl( before, key, x.release() );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
template< class PtrMapAdapter >
|
||||
bool transfer( BOOST_DEDUCED_TYPENAME PtrMapAdapter::iterator object,
|
||||
bool transfer( BOOST_DEDUCED_TYPENAME PtrMapAdapter::iterator object,
|
||||
PtrMapAdapter& from ) // strong
|
||||
{
|
||||
return this->single_transfer( object, from );
|
||||
}
|
||||
|
||||
template< class PtrMapAdapter >
|
||||
size_type transfer( BOOST_DEDUCED_TYPENAME PtrMapAdapter::iterator first,
|
||||
BOOST_DEDUCED_TYPENAME PtrMapAdapter::iterator last,
|
||||
size_type transfer( BOOST_DEDUCED_TYPENAME PtrMapAdapter::iterator first,
|
||||
BOOST_DEDUCED_TYPENAME PtrMapAdapter::iterator last,
|
||||
PtrMapAdapter& from ) // basic
|
||||
{
|
||||
return this->single_transfer( first, last, from );
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
#else
|
||||
#else
|
||||
|
||||
template< class PtrMapAdapter, class Range >
|
||||
BOOST_DEDUCED_TYPENAME boost::disable_if< boost::is_same< Range,
|
||||
@@ -676,7 +676,7 @@ namespace ptr_container_detail
|
||||
{
|
||||
return transfer( boost::begin(r), boost::end(r), from );
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
template< class PtrMapAdapter >
|
||||
@@ -685,29 +685,29 @@ namespace ptr_container_detail
|
||||
return transfer( from.begin(), from.end(), from );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// ptr_multimap_adapter
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template
|
||||
<
|
||||
<
|
||||
class T,
|
||||
class VoidPtrMultiMap,
|
||||
class VoidPtrMultiMap,
|
||||
class CloneAllocator = heap_clone_allocator,
|
||||
bool Ordered = true
|
||||
>
|
||||
class ptr_multimap_adapter :
|
||||
class ptr_multimap_adapter :
|
||||
public ptr_container_detail::ptr_map_adapter_base<T,VoidPtrMultiMap,CloneAllocator,Ordered>
|
||||
{
|
||||
typedef ptr_container_detail::ptr_map_adapter_base<T,VoidPtrMultiMap,CloneAllocator,Ordered>
|
||||
base_type;
|
||||
|
||||
public: // typedefs
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::iterator
|
||||
iterator;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::const_iterator
|
||||
const_iterator;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::iterator
|
||||
iterator;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::const_iterator
|
||||
const_iterator;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::size_type
|
||||
size_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::key_type
|
||||
@@ -717,40 +717,40 @@ namespace ptr_container_detail
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::mapped_type
|
||||
mapped_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::auto_type
|
||||
auto_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME VoidPtrMultiMap::allocator_type
|
||||
auto_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME VoidPtrMultiMap::allocator_type
|
||||
allocator_type;
|
||||
private:
|
||||
|
||||
void safe_insert( const key_type& key, auto_type ptr ) // strong
|
||||
{
|
||||
this->base().insert(
|
||||
std::make_pair( key, ptr.get() ) ); // strong, commit
|
||||
this->base().insert(
|
||||
std::make_pair( key, ptr.get() ) ); // strong, commit
|
||||
ptr.release(); // nothrow
|
||||
}
|
||||
|
||||
template< typename II >
|
||||
void map_basic_clone_and_insert( II first, II last )
|
||||
{
|
||||
while( first != last )
|
||||
{
|
||||
const_reference pair = *first.base(); // nothrow
|
||||
auto_type ptr( this->null_policy_allocate_clone(pair.second), *this );
|
||||
|
||||
template< typename II >
|
||||
void map_basic_clone_and_insert( II first, II last )
|
||||
{
|
||||
while( first != last )
|
||||
{
|
||||
const_reference pair = *first.base(); // nothrow
|
||||
auto_type ptr( this->null_policy_allocate_clone(pair.second), *this );
|
||||
// strong
|
||||
safe_insert( pair.first,
|
||||
safe_insert( pair.first,
|
||||
boost::ptr_container::move( ptr ) );
|
||||
// strong, commit
|
||||
++first;
|
||||
}
|
||||
// strong, commit
|
||||
++first;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
|
||||
ptr_multimap_adapter()
|
||||
{ }
|
||||
|
||||
template< class SizeType >
|
||||
ptr_multimap_adapter( SizeType n,
|
||||
ptr_multimap_adapter( SizeType n,
|
||||
ptr_container_detail::unordered_associative_container_tag tag )
|
||||
: base_type( n, tag )
|
||||
{ }
|
||||
@@ -772,7 +772,7 @@ namespace ptr_container_detail
|
||||
{
|
||||
map_basic_clone_and_insert( first, last );
|
||||
}
|
||||
|
||||
|
||||
template< class InputIterator, class Comp >
|
||||
ptr_multimap_adapter( InputIterator first, InputIterator last,
|
||||
const Comp& comp,
|
||||
@@ -789,20 +789,20 @@ namespace ptr_container_detail
|
||||
const Allocator& a )
|
||||
: base_type( hash, pred, a )
|
||||
{
|
||||
map_basic_clone_and_insert( first, last );
|
||||
map_basic_clone_and_insert( first, last );
|
||||
}
|
||||
|
||||
ptr_multimap_adapter( const ptr_multimap_adapter& r )
|
||||
{
|
||||
map_basic_clone_and_insert( r.begin(), r.end() );
|
||||
map_basic_clone_and_insert( r.begin(), r.end() );
|
||||
}
|
||||
|
||||
|
||||
template< class Key, class U, class CA, bool b >
|
||||
ptr_multimap_adapter( const ptr_multimap_adapter<Key,U,CA,b>& r )
|
||||
{
|
||||
map_basic_clone_and_insert( r.begin(), r.end() );
|
||||
map_basic_clone_and_insert( r.begin(), r.end() );
|
||||
}
|
||||
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
template< class U >
|
||||
explicit ptr_multimap_adapter( std::auto_ptr<U> r ) : base_type( r )
|
||||
@@ -823,7 +823,7 @@ namespace ptr_container_detail
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
template< class U >
|
||||
ptr_multimap_adapter& operator=( std::auto_ptr<U> r )
|
||||
{
|
||||
{
|
||||
base_type::operator=( r );
|
||||
return *this;
|
||||
}
|
||||
@@ -831,7 +831,7 @@ namespace ptr_container_detail
|
||||
#ifndef BOOST_NO_CXX11_SMART_PTR
|
||||
template< class U >
|
||||
ptr_multimap_adapter& operator=( std::unique_ptr<U> r )
|
||||
{
|
||||
{
|
||||
base_type::operator=( std::move( r ) );
|
||||
return *this;
|
||||
}
|
||||
@@ -842,29 +842,29 @@ namespace ptr_container_detail
|
||||
private:
|
||||
iterator insert_impl( const key_type& key, mapped_type x ) // strong
|
||||
{
|
||||
this->enforce_null_policy( x,
|
||||
this->enforce_null_policy( x,
|
||||
"Null pointer in 'ptr_multimap_adapter::insert()'" );
|
||||
|
||||
auto_type ptr( x, *this ); // nothrow
|
||||
BOOST_DEDUCED_TYPENAME base_type::ptr_iterator
|
||||
res = this->base().insert( std::make_pair( key, x ) );
|
||||
// strong, commit
|
||||
// strong, commit
|
||||
ptr.release(); // notrow
|
||||
return iterator( res );
|
||||
return iterator( res );
|
||||
}
|
||||
|
||||
iterator insert_impl( iterator before, const key_type& key, mapped_type x ) // strong
|
||||
{
|
||||
this->enforce_null_policy( x,
|
||||
this->enforce_null_policy( x,
|
||||
"Null pointer in 'ptr_multimap_adapter::insert()'" );
|
||||
|
||||
|
||||
auto_type ptr( x, *this ); // nothrow
|
||||
BOOST_DEDUCED_TYPENAME base_type::ptr_iterator
|
||||
res = this->base().insert( before.base(),
|
||||
res = this->base().insert( before.base(),
|
||||
std::make_pair( key, x ) );
|
||||
// strong, commit
|
||||
// strong, commit
|
||||
ptr.release(); // notrow
|
||||
return iterator( res );
|
||||
return iterator( res );
|
||||
}
|
||||
|
||||
public:
|
||||
@@ -903,9 +903,9 @@ namespace ptr_container_detail
|
||||
template< class F, class S >
|
||||
iterator insert( iterator before, ptr_container_detail::ref_pair<F,S> p ) // strong
|
||||
{
|
||||
this->enforce_null_policy( p.second,
|
||||
this->enforce_null_policy( p.second,
|
||||
"Null pointer in 'ptr_multimap_adapter::insert()'" );
|
||||
iterator res = insert_impl( before, p.first,
|
||||
iterator res = insert_impl( before, p.first,
|
||||
this->null_policy_allocate_clone( p.second ) );
|
||||
return res;
|
||||
}
|
||||
@@ -929,24 +929,24 @@ namespace ptr_container_detail
|
||||
return insert_impl( before, key, x.release() );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
template< class PtrMapAdapter >
|
||||
void transfer( BOOST_DEDUCED_TYPENAME PtrMapAdapter::iterator object,
|
||||
void transfer( BOOST_DEDUCED_TYPENAME PtrMapAdapter::iterator object,
|
||||
PtrMapAdapter& from ) // strong
|
||||
{
|
||||
this->multi_transfer( object, from );
|
||||
}
|
||||
|
||||
template< class PtrMapAdapter >
|
||||
size_type transfer( BOOST_DEDUCED_TYPENAME PtrMapAdapter::iterator first,
|
||||
BOOST_DEDUCED_TYPENAME PtrMapAdapter::iterator last,
|
||||
size_type transfer( BOOST_DEDUCED_TYPENAME PtrMapAdapter::iterator first,
|
||||
BOOST_DEDUCED_TYPENAME PtrMapAdapter::iterator last,
|
||||
PtrMapAdapter& from ) // basic
|
||||
{
|
||||
return this->multi_transfer( first, last, from );
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
#else
|
||||
#else
|
||||
|
||||
template< class PtrMapAdapter, class Range >
|
||||
BOOST_DEDUCED_TYPENAME boost::disable_if< boost::is_same< Range,
|
||||
@@ -957,7 +957,7 @@ namespace ptr_container_detail
|
||||
return transfer( boost::begin(r), boost::end(r), from );
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
template< class PtrMapAdapter >
|
||||
void transfer( PtrMapAdapter& from ) // basic
|
||||
{
|
||||
@@ -972,8 +972,8 @@ namespace ptr_container_detail
|
||||
{
|
||||
return i->second == 0;
|
||||
}
|
||||
|
||||
} // namespace 'boost'
|
||||
|
||||
} // namespace 'boost'
|
||||
|
||||
#if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED)
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -31,12 +31,12 @@
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
{
|
||||
namespace ptr_container_detail
|
||||
{
|
||||
{
|
||||
template
|
||||
<
|
||||
class T,
|
||||
<
|
||||
class T,
|
||||
class VoidPtrSeq
|
||||
>
|
||||
struct sequence_config
|
||||
@@ -48,13 +48,13 @@ namespace ptr_container_detail
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME VoidPtrSeq::allocator_type
|
||||
allocator_type;
|
||||
|
||||
|
||||
typedef U value_type;
|
||||
|
||||
typedef void_ptr_iterator<
|
||||
BOOST_DEDUCED_TYPENAME VoidPtrSeq::iterator, U >
|
||||
BOOST_DEDUCED_TYPENAME VoidPtrSeq::iterator, U >
|
||||
iterator;
|
||||
|
||||
|
||||
typedef void_ptr_iterator<
|
||||
BOOST_DEDUCED_TYPENAME VoidPtrSeq::const_iterator, const U >
|
||||
const_iterator;
|
||||
@@ -66,7 +66,7 @@ namespace ptr_container_detail
|
||||
{
|
||||
return static_cast<U*>( *i.base() );
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
template< class Iter >
|
||||
static U* get_pointer( void_ptr_iterator<Iter,U> i )
|
||||
@@ -79,7 +79,7 @@ namespace ptr_container_detail
|
||||
{
|
||||
return &*i;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_NO_SFINAE) && !BOOST_WORKAROUND(__MWERKS__, <= 0x3003)
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace ptr_container_detail
|
||||
{
|
||||
return static_cast<const U*>( *i.base() );
|
||||
}
|
||||
|
||||
|
||||
#else // BOOST_NO_SFINAE
|
||||
|
||||
template< class Iter >
|
||||
@@ -107,7 +107,7 @@ namespace ptr_container_detail
|
||||
|
||||
BOOST_STATIC_CONSTANT(bool, allow_null = boost::is_nullable<T>::value );
|
||||
};
|
||||
|
||||
|
||||
} // ptr_container_detail
|
||||
|
||||
|
||||
@@ -118,40 +118,40 @@ namespace ptr_container_detail
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
<
|
||||
class T,
|
||||
class VoidPtrSeq,
|
||||
class VoidPtrSeq,
|
||||
class CloneAllocator = heap_clone_allocator
|
||||
>
|
||||
class ptr_sequence_adapter : public
|
||||
ptr_container_detail::reversible_ptr_container< ptr_container_detail::sequence_config<T,VoidPtrSeq>,
|
||||
class ptr_sequence_adapter : public
|
||||
ptr_container_detail::reversible_ptr_container< ptr_container_detail::sequence_config<T,VoidPtrSeq>,
|
||||
CloneAllocator >
|
||||
{
|
||||
typedef ptr_container_detail::reversible_ptr_container< ptr_container_detail::sequence_config<T,VoidPtrSeq>,
|
||||
CloneAllocator >
|
||||
base_type;
|
||||
|
||||
typedef ptr_sequence_adapter<T,VoidPtrSeq,CloneAllocator>
|
||||
|
||||
typedef ptr_sequence_adapter<T,VoidPtrSeq,CloneAllocator>
|
||||
this_type;
|
||||
|
||||
protected:
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::scoped_deleter scoped_deleter;
|
||||
|
||||
|
||||
public:
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::value_type value_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::reference reference;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::const_reference
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::value_type value_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::reference reference;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::const_reference
|
||||
const_reference;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::auto_type auto_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::clone_allocator_type
|
||||
clone_allocator_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::iterator iterator;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::size_type size_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::allocator_type
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::iterator iterator;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::size_type size_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::allocator_type
|
||||
allocator_type;
|
||||
|
||||
|
||||
ptr_sequence_adapter()
|
||||
{ }
|
||||
|
||||
@@ -161,13 +161,13 @@ namespace ptr_container_detail
|
||||
{ }
|
||||
|
||||
template< class SizeType >
|
||||
ptr_sequence_adapter( SizeType n,
|
||||
ptr_sequence_adapter( SizeType n,
|
||||
ptr_container_detail::fixed_length_sequence_tag tag )
|
||||
: base_type( n, tag )
|
||||
{ }
|
||||
|
||||
template< class SizeType, class Allocator >
|
||||
ptr_sequence_adapter( SizeType n, const Allocator& a,
|
||||
ptr_sequence_adapter( SizeType n, const Allocator& a,
|
||||
ptr_container_detail::fixed_length_sequence_tag tag )
|
||||
: base_type( n, a, tag )
|
||||
{ }
|
||||
@@ -201,23 +201,23 @@ namespace ptr_container_detail
|
||||
ptr_sequence_adapter( const ptr_sequence_adapter& r )
|
||||
: base_type( r )
|
||||
{ }
|
||||
|
||||
|
||||
template< class U >
|
||||
ptr_sequence_adapter( const ptr_sequence_adapter<U,VoidPtrSeq,CloneAllocator>& r )
|
||||
: base_type( r )
|
||||
{ }
|
||||
|
||||
|
||||
ptr_sequence_adapter( const ptr_sequence_adapter& r,
|
||||
ptr_container_detail::fixed_length_sequence_tag tag )
|
||||
: base_type( r, tag )
|
||||
{ }
|
||||
|
||||
|
||||
template< class U >
|
||||
ptr_sequence_adapter( const ptr_sequence_adapter<U,VoidPtrSeq,CloneAllocator>& r,
|
||||
ptr_container_detail::fixed_length_sequence_tag tag )
|
||||
: base_type( r, tag )
|
||||
{ }
|
||||
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
template< class PtrContainer >
|
||||
explicit ptr_sequence_adapter( std::auto_ptr<PtrContainer> clone )
|
||||
@@ -234,9 +234,9 @@ namespace ptr_container_detail
|
||||
ptr_sequence_adapter& operator=( const ptr_sequence_adapter r )
|
||||
{
|
||||
this->swap( r );
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
template< class PtrContainer >
|
||||
ptr_sequence_adapter& operator=( std::auto_ptr<PtrContainer> clone )
|
||||
@@ -258,7 +258,7 @@ namespace ptr_container_detail
|
||||
// modifiers
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
void push_back( value_type x ) // strong
|
||||
void push_back( value_type x ) // strong
|
||||
{
|
||||
this->enforce_null_policy( x, "Null pointer in 'push_back()'" );
|
||||
auto_type ptr( x, *this ); // notrow
|
||||
@@ -280,11 +280,11 @@ namespace ptr_container_detail
|
||||
push_back( x.release() );
|
||||
}
|
||||
#endif
|
||||
|
||||
void push_front( value_type x )
|
||||
|
||||
void push_front( value_type x )
|
||||
{
|
||||
this->enforce_null_policy( x, "Null pointer in 'push_front()'" );
|
||||
auto_type ptr( x, *this ); // nothrow
|
||||
auto_type ptr( x, *this ); // nothrow
|
||||
this->base().push_front( x ); // strong, commit
|
||||
ptr.release(); // nothrow
|
||||
}
|
||||
@@ -306,9 +306,9 @@ namespace ptr_container_detail
|
||||
|
||||
auto_type pop_back()
|
||||
{
|
||||
BOOST_ASSERT( !this->empty() &&
|
||||
BOOST_ASSERT( !this->empty() &&
|
||||
"'pop_back()' on empty container" );
|
||||
auto_type ptr( static_cast<value_type>(this->base().back()), *this );
|
||||
auto_type ptr( static_cast<value_type>(this->base().back()), *this );
|
||||
// nothrow
|
||||
this->base().pop_back(); // nothrow
|
||||
return ptr_container_detail::move( ptr ); // nothrow
|
||||
@@ -317,23 +317,23 @@ namespace ptr_container_detail
|
||||
auto_type pop_front()
|
||||
{
|
||||
BOOST_ASSERT( !this->empty() &&
|
||||
"'pop_front()' on empty container" );
|
||||
auto_type ptr( static_cast<value_type>(this->base().front()), *this );
|
||||
// nothrow
|
||||
"'pop_front()' on empty container" );
|
||||
auto_type ptr( static_cast<value_type>(this->base().front()), *this );
|
||||
// nothrow
|
||||
this->base().pop_front(); // nothrow
|
||||
return ptr_container_detail::move( ptr );
|
||||
return ptr_container_detail::move( ptr );
|
||||
}
|
||||
|
||||
reference front()
|
||||
{
|
||||
|
||||
reference front()
|
||||
{
|
||||
BOOST_ASSERT( !this->empty() &&
|
||||
"accessing 'front()' on empty container" );
|
||||
|
||||
BOOST_ASSERT( !::boost::is_null( this->begin() ) );
|
||||
return *this->begin();
|
||||
return *this->begin();
|
||||
}
|
||||
|
||||
const_reference front() const
|
||||
const_reference front() const
|
||||
{
|
||||
return const_cast<ptr_sequence_adapter*>(this)->front();
|
||||
}
|
||||
@@ -343,7 +343,7 @@ namespace ptr_container_detail
|
||||
BOOST_ASSERT( !this->empty() &&
|
||||
"accessing 'back()' on empty container" );
|
||||
BOOST_ASSERT( !::boost::is_null( --this->end() ) );
|
||||
return *--this->end();
|
||||
return *--this->end();
|
||||
}
|
||||
|
||||
const_reference back() const
|
||||
@@ -352,52 +352,52 @@ namespace ptr_container_detail
|
||||
}
|
||||
|
||||
public: // deque/vector inerface
|
||||
|
||||
reference operator[]( size_type n ) // nothrow
|
||||
|
||||
reference operator[]( size_type n ) // nothrow
|
||||
{
|
||||
BOOST_ASSERT( n < this->size() );
|
||||
BOOST_ASSERT( !this->is_null( n ) );
|
||||
return *static_cast<value_type>( this->base()[n] );
|
||||
return *static_cast<value_type>( this->base()[n] );
|
||||
}
|
||||
|
||||
const_reference operator[]( size_type n ) const // nothrow
|
||||
{
|
||||
BOOST_ASSERT( n < this->size() );
|
||||
|
||||
const_reference operator[]( size_type n ) const // nothrow
|
||||
{
|
||||
BOOST_ASSERT( n < this->size() );
|
||||
BOOST_ASSERT( !this->is_null( n ) );
|
||||
return *static_cast<value_type>( this->base()[n] );
|
||||
}
|
||||
|
||||
|
||||
reference at( size_type n )
|
||||
{
|
||||
BOOST_PTR_CONTAINER_THROW_EXCEPTION( n >= this->size(), bad_index,
|
||||
BOOST_PTR_CONTAINER_THROW_EXCEPTION( n >= this->size(), bad_index,
|
||||
"'at()' out of bounds" );
|
||||
BOOST_ASSERT( !this->is_null( n ) );
|
||||
return (*this)[n];
|
||||
}
|
||||
|
||||
|
||||
const_reference at( size_type n ) const
|
||||
{
|
||||
BOOST_PTR_CONTAINER_THROW_EXCEPTION( n >= this->size(), bad_index,
|
||||
BOOST_PTR_CONTAINER_THROW_EXCEPTION( n >= this->size(), bad_index,
|
||||
"'at()' out of bounds" );
|
||||
BOOST_ASSERT( !this->is_null( n ) );
|
||||
return (*this)[n];
|
||||
return (*this)[n];
|
||||
}
|
||||
|
||||
|
||||
public: // vector interface
|
||||
|
||||
|
||||
size_type capacity() const
|
||||
{
|
||||
return this->base().capacity();
|
||||
}
|
||||
|
||||
|
||||
void reserve( size_type n )
|
||||
{
|
||||
this->base().reserve( n );
|
||||
this->base().reserve( n );
|
||||
}
|
||||
|
||||
void reverse()
|
||||
{
|
||||
this->base().reverse();
|
||||
this->base().reverse();
|
||||
}
|
||||
|
||||
public: // assign, insert, transfer
|
||||
@@ -405,7 +405,7 @@ namespace ptr_container_detail
|
||||
// overhead: 1 heap allocation (very cheap compared to cloning)
|
||||
template< class InputIterator >
|
||||
void assign( InputIterator first, InputIterator last ) // strong
|
||||
{
|
||||
{
|
||||
base_type temp( first, last );
|
||||
this->swap( temp );
|
||||
}
|
||||
@@ -427,22 +427,22 @@ namespace ptr_container_detail
|
||||
template< class I >
|
||||
void insert_impl( iterator before, I first, I last, std::forward_iterator_tag ) // strong
|
||||
{
|
||||
if( first == last )
|
||||
if( first == last )
|
||||
return;
|
||||
scoped_deleter sd( *this, first, last ); // strong
|
||||
this->insert_clones_and_release( sd, before ); // strong, commit
|
||||
this->insert_clones_and_release( sd, before ); // strong, commit
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
using base_type::insert;
|
||||
|
||||
|
||||
template< class InputIterator >
|
||||
void insert( iterator before, InputIterator first, InputIterator last ) // strong
|
||||
{
|
||||
insert_impl( before, first, last, BOOST_DEDUCED_TYPENAME
|
||||
iterator_category<InputIterator>::type() );
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
#else
|
||||
@@ -455,11 +455,11 @@ namespace ptr_container_detail
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
template< class PtrSeqAdapter >
|
||||
void transfer( iterator before,
|
||||
BOOST_DEDUCED_TYPENAME PtrSeqAdapter::iterator first,
|
||||
BOOST_DEDUCED_TYPENAME PtrSeqAdapter::iterator last,
|
||||
void transfer( iterator before,
|
||||
BOOST_DEDUCED_TYPENAME PtrSeqAdapter::iterator first,
|
||||
BOOST_DEDUCED_TYPENAME PtrSeqAdapter::iterator last,
|
||||
PtrSeqAdapter& from ) // strong
|
||||
{
|
||||
BOOST_ASSERT( (void*)&from != (void*)this );
|
||||
@@ -471,20 +471,20 @@ namespace ptr_container_detail
|
||||
}
|
||||
|
||||
template< class PtrSeqAdapter >
|
||||
void transfer( iterator before,
|
||||
BOOST_DEDUCED_TYPENAME PtrSeqAdapter::iterator object,
|
||||
void transfer( iterator before,
|
||||
BOOST_DEDUCED_TYPENAME PtrSeqAdapter::iterator object,
|
||||
PtrSeqAdapter& from ) // strong
|
||||
{
|
||||
BOOST_ASSERT( (void*)&from != (void*)this );
|
||||
if( from.empty() )
|
||||
return;
|
||||
this->base().insert( before.base(), *object.base() ); // strong
|
||||
from.base().erase( object.base() ); // nothrow
|
||||
this->base().insert( before.base(), *object.base() ); // strong
|
||||
from.base().erase( object.base() ); // nothrow
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
#else
|
||||
|
||||
|
||||
template< class PtrSeqAdapter, class Range >
|
||||
BOOST_DEDUCED_TYPENAME boost::disable_if< boost::is_same< Range,
|
||||
BOOST_DEDUCED_TYPENAME PtrSeqAdapter::iterator > >::type
|
||||
@@ -507,14 +507,14 @@ namespace ptr_container_detail
|
||||
}
|
||||
|
||||
public: // C-array support
|
||||
|
||||
void transfer( iterator before, value_type* from,
|
||||
size_type size, bool delete_from = true ) // strong
|
||||
|
||||
void transfer( iterator before, value_type* from,
|
||||
size_type size, bool delete_from = true ) // strong
|
||||
{
|
||||
BOOST_ASSERT( from != 0 );
|
||||
if( delete_from )
|
||||
{
|
||||
BOOST_DEDUCED_TYPENAME base_type::scoped_deleter
|
||||
BOOST_DEDUCED_TYPENAME base_type::scoped_deleter
|
||||
deleter( *this, from, size ); // nothrow
|
||||
this->base().insert( before.base(), from, from + size ); // strong
|
||||
deleter.release(); // nothrow
|
||||
@@ -534,7 +534,7 @@ namespace ptr_container_detail
|
||||
}
|
||||
|
||||
public: // null functions
|
||||
|
||||
|
||||
bool is_null( size_type idx ) const
|
||||
{
|
||||
BOOST_ASSERT( idx < this->size() );
|
||||
@@ -548,13 +548,13 @@ namespace ptr_container_detail
|
||||
size_type old_size = this->size();
|
||||
if( old_size > size )
|
||||
{
|
||||
this->erase( boost::next( this->begin(), size ), this->end() );
|
||||
this->erase( boost::next( this->begin(), size ), this->end() );
|
||||
}
|
||||
else if( size > old_size )
|
||||
{
|
||||
for( ; old_size != size; ++old_size )
|
||||
this->push_back( new BOOST_DEDUCED_TYPENAME
|
||||
boost::remove_pointer<value_type>::type() );
|
||||
this->push_back( new BOOST_DEDUCED_TYPENAME
|
||||
boost::remove_pointer<value_type>::type() );
|
||||
}
|
||||
|
||||
BOOST_ASSERT( this->size() == size );
|
||||
@@ -565,15 +565,15 @@ namespace ptr_container_detail
|
||||
size_type old_size = this->size();
|
||||
if( old_size > size )
|
||||
{
|
||||
this->erase( boost::next( this->begin(), size ), this->end() );
|
||||
this->erase( boost::next( this->begin(), size ), this->end() );
|
||||
}
|
||||
else if( size > old_size )
|
||||
{
|
||||
for( ; old_size != size; ++old_size )
|
||||
this->push_back( this->null_policy_allocate_clone( to_clone ) );
|
||||
this->push_back( this->null_policy_allocate_clone( to_clone ) );
|
||||
}
|
||||
|
||||
BOOST_ASSERT( this->size() == size );
|
||||
BOOST_ASSERT( this->size() == size );
|
||||
}
|
||||
|
||||
void rresize( size_type size ) // basic
|
||||
@@ -581,14 +581,14 @@ namespace ptr_container_detail
|
||||
size_type old_size = this->size();
|
||||
if( old_size > size )
|
||||
{
|
||||
this->erase( this->begin(),
|
||||
boost::next( this->begin(), old_size - size ) );
|
||||
this->erase( this->begin(),
|
||||
boost::next( this->begin(), old_size - size ) );
|
||||
}
|
||||
else if( size > old_size )
|
||||
{
|
||||
for( ; old_size != size; ++old_size )
|
||||
this->push_front( new BOOST_DEDUCED_TYPENAME
|
||||
boost::remove_pointer<value_type>::type() );
|
||||
this->push_front( new BOOST_DEDUCED_TYPENAME
|
||||
boost::remove_pointer<value_type>::type() );
|
||||
}
|
||||
|
||||
BOOST_ASSERT( this->size() == size );
|
||||
@@ -599,25 +599,25 @@ namespace ptr_container_detail
|
||||
size_type old_size = this->size();
|
||||
if( old_size > size )
|
||||
{
|
||||
this->erase( this->begin(),
|
||||
boost::next( this->begin(), old_size - size ) );
|
||||
this->erase( this->begin(),
|
||||
boost::next( this->begin(), old_size - size ) );
|
||||
}
|
||||
else if( size > old_size )
|
||||
{
|
||||
for( ; old_size != size; ++old_size )
|
||||
this->push_front( this->null_policy_allocate_clone( to_clone ) );
|
||||
this->push_front( this->null_policy_allocate_clone( to_clone ) );
|
||||
}
|
||||
|
||||
BOOST_ASSERT( this->size() == size );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public: // algorithms
|
||||
|
||||
void sort( iterator first, iterator last )
|
||||
{
|
||||
sort( first, last, std::less<T>() );
|
||||
}
|
||||
|
||||
|
||||
void sort()
|
||||
{
|
||||
sort( this->begin(), this->end() );
|
||||
@@ -628,23 +628,23 @@ namespace ptr_container_detail
|
||||
{
|
||||
BOOST_ASSERT( first <= last && "out of range sort()" );
|
||||
BOOST_ASSERT( this->begin() <= first && "out of range sort()" );
|
||||
BOOST_ASSERT( last <= this->end() && "out of range sort()" );
|
||||
BOOST_ASSERT( last <= this->end() && "out of range sort()" );
|
||||
// some static assert on the arguments of the comparison
|
||||
std::sort( first.base(), last.base(),
|
||||
std::sort( first.base(), last.base(),
|
||||
void_ptr_indirect_fun<Compare,T>(comp) );
|
||||
}
|
||||
|
||||
|
||||
template< class Compare >
|
||||
void sort( Compare comp )
|
||||
{
|
||||
sort( this->begin(), this->end(), comp );
|
||||
}
|
||||
|
||||
|
||||
void unique( iterator first, iterator last )
|
||||
{
|
||||
unique( first, last, std::equal_to<T>() );
|
||||
}
|
||||
|
||||
|
||||
void unique()
|
||||
{
|
||||
unique( this->begin(), this->end() );
|
||||
@@ -662,23 +662,23 @@ namespace ptr_container_detail
|
||||
|
||||
protected:
|
||||
template< class Fun, class Arg1 >
|
||||
class void_ptr_delete_if
|
||||
class void_ptr_delete_if
|
||||
{
|
||||
Fun fun;
|
||||
public:
|
||||
|
||||
|
||||
void_ptr_delete_if() : fun(Fun())
|
||||
{ }
|
||||
|
||||
|
||||
void_ptr_delete_if( Fun f ) : fun(f)
|
||||
{ }
|
||||
|
||||
|
||||
bool operator()( void* r ) const
|
||||
{
|
||||
BOOST_ASSERT( r != 0 );
|
||||
Arg1 arg1 = static_cast<Arg1>(r);
|
||||
if( fun( *arg1 ) )
|
||||
{
|
||||
{
|
||||
clone_allocator_type::deallocate_clone( arg1 );
|
||||
return true;
|
||||
}
|
||||
@@ -689,15 +689,15 @@ namespace ptr_container_detail
|
||||
private:
|
||||
void compact_and_erase_nulls( iterator first, iterator last ) // nothrow
|
||||
{
|
||||
typename base_type::ptr_iterator p = std::stable_partition(
|
||||
first.base(),
|
||||
last.base(),
|
||||
typename base_type::ptr_iterator p = std::stable_partition(
|
||||
first.base(),
|
||||
last.base(),
|
||||
is_not_zero_ptr() );
|
||||
this->base().erase( p, this->end().base() );
|
||||
|
||||
|
||||
}
|
||||
|
||||
void range_check_impl( iterator, iterator,
|
||||
void range_check_impl( iterator, iterator,
|
||||
std::bidirectional_iterator_tag )
|
||||
{ /* do nothing */ }
|
||||
|
||||
@@ -706,22 +706,22 @@ namespace ptr_container_detail
|
||||
{
|
||||
BOOST_ASSERT( first <= last && "out of range unique()/erase_if()" );
|
||||
BOOST_ASSERT( this->begin() <= first && "out of range unique()/erase_if()" );
|
||||
BOOST_ASSERT( last <= this->end() && "out of range unique()/erase_if)(" );
|
||||
BOOST_ASSERT( last <= this->end() && "out of range unique()/erase_if)(" );
|
||||
}
|
||||
|
||||
|
||||
void range_check( iterator first, iterator last )
|
||||
{
|
||||
range_check_impl( first, last,
|
||||
range_check_impl( first, last,
|
||||
BOOST_DEDUCED_TYPENAME iterator_category<iterator>::type() );
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
template< class Compare >
|
||||
void unique( iterator first, iterator last, Compare comp )
|
||||
{
|
||||
range_check(first,last);
|
||||
|
||||
|
||||
iterator prev = first;
|
||||
iterator next = first;
|
||||
++next;
|
||||
@@ -743,7 +743,7 @@ namespace ptr_container_detail
|
||||
|
||||
compact_and_erase_nulls( first, last );
|
||||
}
|
||||
|
||||
|
||||
template< class Compare >
|
||||
void unique( Compare comp )
|
||||
{
|
||||
@@ -754,11 +754,11 @@ namespace ptr_container_detail
|
||||
void erase_if( iterator first, iterator last, Pred pred )
|
||||
{
|
||||
range_check(first,last);
|
||||
this->base().erase( std::remove_if( first.base(), last.base(),
|
||||
this->base().erase( std::remove_if( first.base(), last.base(),
|
||||
void_ptr_delete_if<Pred,value_type>(pred) ),
|
||||
last.base() );
|
||||
last.base() );
|
||||
}
|
||||
|
||||
|
||||
template< class Pred >
|
||||
void erase_if( Pred pred )
|
||||
{
|
||||
@@ -766,44 +766,44 @@ namespace ptr_container_detail
|
||||
}
|
||||
|
||||
|
||||
void merge( iterator first, iterator last,
|
||||
void merge( iterator first, iterator last,
|
||||
ptr_sequence_adapter& from )
|
||||
{
|
||||
merge( first, last, from, std::less<T>() );
|
||||
}
|
||||
|
||||
|
||||
template< class BinPred >
|
||||
void merge( iterator first, iterator last,
|
||||
void merge( iterator first, iterator last,
|
||||
ptr_sequence_adapter& from, BinPred pred )
|
||||
{
|
||||
void_ptr_indirect_fun<BinPred,T> bin_pred(pred);
|
||||
size_type current_size = this->size();
|
||||
size_type current_size = this->size();
|
||||
this->transfer( this->end(), first, last, from );
|
||||
typename base_type::ptr_iterator middle = this->begin().base();
|
||||
std::advance(middle,current_size);
|
||||
std::advance(middle,current_size);
|
||||
std::inplace_merge( this->begin().base(),
|
||||
middle,
|
||||
this->end().base(),
|
||||
bin_pred );
|
||||
}
|
||||
|
||||
|
||||
void merge( ptr_sequence_adapter& r )
|
||||
{
|
||||
merge( r, std::less<T>() );
|
||||
BOOST_ASSERT( r.empty() );
|
||||
}
|
||||
|
||||
|
||||
template< class BinPred >
|
||||
void merge( ptr_sequence_adapter& r, BinPred pred )
|
||||
{
|
||||
merge( r.begin(), r.end(), r, pred );
|
||||
BOOST_ASSERT( r.empty() );
|
||||
BOOST_ASSERT( r.empty() );
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace 'boost'
|
||||
} // namespace 'boost'
|
||||
|
||||
#if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED)
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -30,13 +30,13 @@ namespace boost
|
||||
{
|
||||
|
||||
template
|
||||
<
|
||||
class Key,
|
||||
<
|
||||
class Key,
|
||||
class Compare = std::less<Key>,
|
||||
class CloneAllocator = heap_clone_allocator,
|
||||
class Allocator = std::allocator<typename ptr_container_detail::void_ptr<Key>::type>
|
||||
>
|
||||
class ptr_set :
|
||||
class ptr_set :
|
||||
public ptr_set_adapter< Key, std::set<
|
||||
typename ptr_container_detail::void_ptr<Key>::type,
|
||||
void_ptr_indirect_fun<Compare,Key>,Allocator>,
|
||||
@@ -49,14 +49,14 @@ namespace boost
|
||||
base_type;
|
||||
|
||||
typedef ptr_set<Key,Compare,CloneAllocator,Allocator> this_type;
|
||||
|
||||
|
||||
public:
|
||||
ptr_set()
|
||||
{ }
|
||||
|
||||
|
||||
explicit ptr_set( const Compare& comp,
|
||||
const Allocator& a = Allocator() )
|
||||
: base_type( comp, a )
|
||||
const Allocator& a = Allocator() )
|
||||
: base_type( comp, a )
|
||||
{ }
|
||||
|
||||
template< typename InputIterator >
|
||||
@@ -65,30 +65,30 @@ namespace boost
|
||||
{ }
|
||||
|
||||
template< typename InputIterator >
|
||||
ptr_set( InputIterator first, InputIterator last,
|
||||
ptr_set( InputIterator first, InputIterator last,
|
||||
const Compare& comp,
|
||||
const Allocator& a = Allocator() )
|
||||
const Allocator& a = Allocator() )
|
||||
: base_type( first, last, comp, a )
|
||||
{ }
|
||||
|
||||
BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_set,
|
||||
base_type,
|
||||
this_type )
|
||||
|
||||
|
||||
BOOST_PTR_CONTAINER_DEFINE_COPY_CONSTRUCTORS( ptr_set, base_type )
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
class Key,
|
||||
<
|
||||
class Key,
|
||||
class Compare = std::less<Key>,
|
||||
class CloneAllocator = heap_clone_allocator,
|
||||
class Allocator = std::allocator<void*>
|
||||
>
|
||||
class ptr_multiset :
|
||||
class ptr_multiset :
|
||||
public ptr_multiset_adapter< Key,
|
||||
std::multiset<void*,void_ptr_indirect_fun<Compare,Key>,Allocator>,
|
||||
CloneAllocator, true >
|
||||
@@ -98,14 +98,14 @@ namespace boost
|
||||
CloneAllocator, true >
|
||||
base_type;
|
||||
typedef ptr_multiset<Key,Compare,CloneAllocator,Allocator> this_type;
|
||||
|
||||
|
||||
public:
|
||||
ptr_multiset()
|
||||
{ }
|
||||
|
||||
|
||||
explicit ptr_multiset( const Compare& comp,
|
||||
const Allocator& a = Allocator() )
|
||||
: base_type( comp, a )
|
||||
: base_type( comp, a )
|
||||
{ }
|
||||
|
||||
template< typename InputIterator >
|
||||
@@ -117,15 +117,15 @@ namespace boost
|
||||
ptr_multiset( InputIterator first, InputIterator last,
|
||||
const Compare& comp,
|
||||
const Allocator& a = Allocator() )
|
||||
: base_type( first, last, comp, a )
|
||||
: base_type( first, last, comp, a )
|
||||
{ }
|
||||
|
||||
BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_multiset,
|
||||
BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_multiset,
|
||||
base_type,
|
||||
this_type )
|
||||
|
||||
BOOST_PTR_CONTAINER_DEFINE_COPY_CONSTRUCTORS( ptr_multiset,
|
||||
base_type )
|
||||
|
||||
BOOST_PTR_CONTAINER_DEFINE_COPY_CONSTRUCTORS( ptr_multiset,
|
||||
base_type )
|
||||
|
||||
};
|
||||
|
||||
@@ -143,7 +143,7 @@ namespace boost
|
||||
{
|
||||
return r.clone().release();
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// swap
|
||||
|
||||
|
||||
@@ -32,53 +32,53 @@ namespace boost
|
||||
namespace ptr_container_detail
|
||||
{
|
||||
template
|
||||
<
|
||||
<
|
||||
class Key,
|
||||
class VoidPtrSet,
|
||||
bool Ordered
|
||||
>
|
||||
struct set_config
|
||||
{
|
||||
typedef VoidPtrSet
|
||||
typedef VoidPtrSet
|
||||
void_container_type;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME VoidPtrSet::allocator_type
|
||||
typedef BOOST_DEDUCED_TYPENAME VoidPtrSet::allocator_type
|
||||
allocator_type;
|
||||
|
||||
typedef Key value_type;
|
||||
|
||||
typedef value_type
|
||||
typedef value_type
|
||||
key_type;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
mpl::eval_if_c<Ordered,
|
||||
select_value_compare<VoidPtrSet>,
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
mpl::eval_if_c<Ordered,
|
||||
select_value_compare<VoidPtrSet>,
|
||||
mpl::identity<void> >::type
|
||||
value_compare;
|
||||
|
||||
typedef value_compare
|
||||
typedef value_compare
|
||||
key_compare;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
mpl::eval_if_c<Ordered,
|
||||
mpl::identity<void>,
|
||||
select_hasher<VoidPtrSet> >::type
|
||||
hasher;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
mpl::eval_if_c<Ordered,
|
||||
mpl::identity<void>,
|
||||
select_key_equal<VoidPtrSet> >::type
|
||||
key_equal;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
mpl::if_c<Ordered,
|
||||
ordered_associative_container_tag,
|
||||
unordered_associative_container_tag>::type
|
||||
container_type;
|
||||
|
||||
typedef void_ptr_iterator<
|
||||
BOOST_DEDUCED_TYPENAME VoidPtrSet::iterator, Key >
|
||||
BOOST_DEDUCED_TYPENAME VoidPtrSet::iterator, Key >
|
||||
iterator;
|
||||
|
||||
typedef void_ptr_iterator<
|
||||
@@ -86,21 +86,21 @@ namespace ptr_container_detail
|
||||
const_iterator;
|
||||
|
||||
typedef void_ptr_iterator<
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
mpl::eval_if_c<Ordered,
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
mpl::eval_if_c<Ordered,
|
||||
select_iterator<VoidPtrSet>,
|
||||
select_local_iterator<VoidPtrSet> >::type,
|
||||
Key >
|
||||
local_iterator;
|
||||
|
||||
typedef void_ptr_iterator<
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
mpl::eval_if_c<Ordered,
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
mpl::eval_if_c<Ordered,
|
||||
select_iterator<VoidPtrSet>,
|
||||
select_const_local_iterator<VoidPtrSet> >::type,
|
||||
const Key >
|
||||
const_local_iterator;
|
||||
|
||||
const_local_iterator;
|
||||
|
||||
template< class Iter >
|
||||
static Key* get_pointer( Iter i )
|
||||
{
|
||||
@@ -116,45 +116,45 @@ namespace ptr_container_detail
|
||||
BOOST_STATIC_CONSTANT(bool, allow_null = false );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
<
|
||||
class Key,
|
||||
class VoidPtrSet,
|
||||
class VoidPtrSet,
|
||||
class CloneAllocator = heap_clone_allocator,
|
||||
bool Ordered = true
|
||||
>
|
||||
class ptr_set_adapter_base
|
||||
class ptr_set_adapter_base
|
||||
: public ptr_container_detail::associative_ptr_container< set_config<Key,VoidPtrSet,Ordered>,
|
||||
CloneAllocator >
|
||||
{
|
||||
typedef ptr_container_detail::associative_ptr_container< set_config<Key,VoidPtrSet,Ordered>,
|
||||
CloneAllocator >
|
||||
base_type;
|
||||
public:
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::iterator
|
||||
public:
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::iterator
|
||||
iterator;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::const_iterator
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::const_iterator
|
||||
const_iterator;
|
||||
typedef Key key_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::size_type
|
||||
size_type;
|
||||
|
||||
public:
|
||||
ptr_set_adapter_base()
|
||||
ptr_set_adapter_base()
|
||||
{ }
|
||||
|
||||
template< class SizeType >
|
||||
ptr_set_adapter_base( SizeType n,
|
||||
ptr_set_adapter_base( SizeType n,
|
||||
ptr_container_detail::unordered_associative_container_tag tag )
|
||||
: base_type( n, tag )
|
||||
{ }
|
||||
|
||||
|
||||
template< class Compare, class Allocator >
|
||||
ptr_set_adapter_base( const Compare& comp,
|
||||
const Allocator& a )
|
||||
: base_type( comp, a )
|
||||
const Allocator& a )
|
||||
: base_type( comp, a )
|
||||
{ }
|
||||
|
||||
template< class Hash, class Pred, class Allocator >
|
||||
@@ -167,8 +167,8 @@ namespace ptr_container_detail
|
||||
template< class InputIterator, class Compare, class Allocator >
|
||||
ptr_set_adapter_base( InputIterator first, InputIterator last,
|
||||
const Compare& comp,
|
||||
const Allocator& a )
|
||||
: base_type( first, last, comp, a )
|
||||
const Allocator& a )
|
||||
: base_type( first, last, comp, a )
|
||||
{ }
|
||||
|
||||
template< class InputIterator, class Hash, class Pred, class Allocator >
|
||||
@@ -178,7 +178,7 @@ namespace ptr_container_detail
|
||||
const Allocator& a )
|
||||
: base_type( first, last, hash, pred, a )
|
||||
{ }
|
||||
|
||||
|
||||
template< class U, class Set, class CA, bool b >
|
||||
ptr_set_adapter_base( const ptr_set_adapter_base<U,Set,CA,b>& r )
|
||||
: base_type( r )
|
||||
@@ -187,7 +187,7 @@ namespace ptr_container_detail
|
||||
ptr_set_adapter_base( const ptr_set_adapter_base& r )
|
||||
: base_type( r )
|
||||
{ }
|
||||
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
template< class PtrContainer >
|
||||
explicit ptr_set_adapter_base( std::auto_ptr<PtrContainer> clone )
|
||||
@@ -200,13 +200,13 @@ namespace ptr_container_detail
|
||||
: base_type( std::move( clone ) )
|
||||
{ }
|
||||
#endif
|
||||
|
||||
ptr_set_adapter_base& operator=( ptr_set_adapter_base r )
|
||||
|
||||
ptr_set_adapter_base& operator=( ptr_set_adapter_base r )
|
||||
{
|
||||
this->swap( r );
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
template< typename PtrContainer >
|
||||
ptr_set_adapter_base& operator=( std::auto_ptr<PtrContainer> clone )
|
||||
@@ -225,80 +225,80 @@ namespace ptr_container_detail
|
||||
#endif
|
||||
|
||||
using base_type::erase;
|
||||
|
||||
|
||||
size_type erase( const key_type& x ) // nothrow
|
||||
{
|
||||
key_type* key = const_cast<key_type*>(&x);
|
||||
iterator i( this->base().find( key ) );
|
||||
iterator i( this->base().find( key ) );
|
||||
if( i == this->end() ) // nothrow
|
||||
return 0u; // nothrow
|
||||
key = static_cast<key_type*>(*i.base()); // nothrow
|
||||
size_type res = this->base().erase( key ); // nothrow
|
||||
size_type res = this->base().erase( key ); // nothrow
|
||||
this->remove( key ); // nothrow
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
iterator find( const key_type& x )
|
||||
{
|
||||
iterator find( const key_type& x )
|
||||
{
|
||||
return iterator( this->base().
|
||||
find( const_cast<key_type*>(&x) ) );
|
||||
}
|
||||
find( const_cast<key_type*>(&x) ) );
|
||||
}
|
||||
|
||||
const_iterator find( const key_type& x ) const
|
||||
{
|
||||
const_iterator find( const key_type& x ) const
|
||||
{
|
||||
return const_iterator( this->base().
|
||||
find( const_cast<key_type*>(&x) ) );
|
||||
}
|
||||
find( const_cast<key_type*>(&x) ) );
|
||||
}
|
||||
|
||||
size_type count( const key_type& x ) const
|
||||
{
|
||||
return this->base().count( const_cast<key_type*>(&x) );
|
||||
}
|
||||
|
||||
iterator lower_bound( const key_type& x )
|
||||
{
|
||||
size_type count( const key_type& x ) const
|
||||
{
|
||||
return this->base().count( const_cast<key_type*>(&x) );
|
||||
}
|
||||
|
||||
iterator lower_bound( const key_type& x )
|
||||
{
|
||||
return iterator( this->base().
|
||||
lower_bound( const_cast<key_type*>(&x) ) );
|
||||
}
|
||||
|
||||
const_iterator lower_bound( const key_type& x ) const
|
||||
{
|
||||
lower_bound( const_cast<key_type*>(&x) ) );
|
||||
}
|
||||
|
||||
const_iterator lower_bound( const key_type& x ) const
|
||||
{
|
||||
return const_iterator( this->base().
|
||||
lower_bound( const_cast<key_type*>(&x) ) );
|
||||
}
|
||||
|
||||
iterator upper_bound( const key_type& x )
|
||||
{
|
||||
lower_bound( const_cast<key_type*>(&x) ) );
|
||||
}
|
||||
|
||||
iterator upper_bound( const key_type& x )
|
||||
{
|
||||
return iterator( this->base().
|
||||
upper_bound( const_cast<key_type*>(&x) ) );
|
||||
}
|
||||
|
||||
const_iterator upper_bound( const key_type& x ) const
|
||||
{
|
||||
upper_bound( const_cast<key_type*>(&x) ) );
|
||||
}
|
||||
|
||||
const_iterator upper_bound( const key_type& x ) const
|
||||
{
|
||||
return const_iterator( this->base().
|
||||
upper_bound( const_cast<key_type*>(&x) ) );
|
||||
}
|
||||
|
||||
iterator_range<iterator> equal_range( const key_type& x )
|
||||
{
|
||||
upper_bound( const_cast<key_type*>(&x) ) );
|
||||
}
|
||||
|
||||
iterator_range<iterator> equal_range( const key_type& x )
|
||||
{
|
||||
std::pair<BOOST_DEDUCED_TYPENAME base_type::ptr_iterator,
|
||||
BOOST_DEDUCED_TYPENAME base_type::ptr_iterator>
|
||||
BOOST_DEDUCED_TYPENAME base_type::ptr_iterator>
|
||||
p = this->base().
|
||||
equal_range( const_cast<key_type*>(&x) );
|
||||
return make_iterator_range( iterator( p.first ),
|
||||
iterator( p.second ) );
|
||||
}
|
||||
|
||||
iterator_range<const_iterator> equal_range( const key_type& x ) const
|
||||
{
|
||||
equal_range( const_cast<key_type*>(&x) );
|
||||
return make_iterator_range( iterator( p.first ),
|
||||
iterator( p.second ) );
|
||||
}
|
||||
|
||||
iterator_range<const_iterator> equal_range( const key_type& x ) const
|
||||
{
|
||||
std::pair<BOOST_DEDUCED_TYPENAME base_type::ptr_const_iterator,
|
||||
BOOST_DEDUCED_TYPENAME base_type::ptr_const_iterator>
|
||||
BOOST_DEDUCED_TYPENAME base_type::ptr_const_iterator>
|
||||
p = this->base().
|
||||
equal_range( const_cast<key_type*>(&x) );
|
||||
return make_iterator_range( const_iterator( p.first ),
|
||||
const_iterator( p.second ) );
|
||||
}
|
||||
equal_range( const_cast<key_type*>(&x) );
|
||||
return make_iterator_range( const_iterator( p.first ),
|
||||
const_iterator( p.second ) );
|
||||
}
|
||||
|
||||
protected:
|
||||
size_type bucket( const key_type& key ) const
|
||||
@@ -312,62 +312,62 @@ namespace ptr_container_detail
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// ptr_set_adapter
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
class Key,
|
||||
class VoidPtrSet,
|
||||
class VoidPtrSet,
|
||||
class CloneAllocator = heap_clone_allocator,
|
||||
bool Ordered = true
|
||||
>
|
||||
class ptr_set_adapter :
|
||||
class ptr_set_adapter :
|
||||
public ptr_container_detail::ptr_set_adapter_base<Key,VoidPtrSet,CloneAllocator,Ordered>
|
||||
{
|
||||
typedef ptr_container_detail::ptr_set_adapter_base<Key,VoidPtrSet,CloneAllocator,Ordered>
|
||||
typedef ptr_container_detail::ptr_set_adapter_base<Key,VoidPtrSet,CloneAllocator,Ordered>
|
||||
base_type;
|
||||
|
||||
|
||||
public: // typedefs
|
||||
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::iterator
|
||||
iterator;
|
||||
iterator;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::const_iterator
|
||||
const_iterator;
|
||||
const_iterator;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::size_type
|
||||
size_type;
|
||||
size_type;
|
||||
typedef Key key_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::auto_type
|
||||
auto_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME VoidPtrSet::allocator_type
|
||||
allocator_type;
|
||||
allocator_type;
|
||||
private:
|
||||
|
||||
template< typename II >
|
||||
void set_basic_clone_and_insert( II first, II last ) // basic
|
||||
{
|
||||
while( first != last )
|
||||
{
|
||||
|
||||
template< typename II >
|
||||
void set_basic_clone_and_insert( II first, II last ) // basic
|
||||
{
|
||||
while( first != last )
|
||||
{
|
||||
if( this->find( *first ) == this->end() )
|
||||
insert( this->null_policy_allocate_clone_from_iterator( first ) ); // strong, commit
|
||||
++first;
|
||||
}
|
||||
}
|
||||
++first;
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
ptr_set_adapter()
|
||||
{ }
|
||||
|
||||
template< class SizeType >
|
||||
ptr_set_adapter( SizeType n,
|
||||
ptr_set_adapter( SizeType n,
|
||||
ptr_container_detail::unordered_associative_container_tag tag )
|
||||
: base_type( n, tag )
|
||||
{ }
|
||||
|
||||
|
||||
template< class Comp >
|
||||
explicit ptr_set_adapter( const Comp& comp,
|
||||
const allocator_type& a )
|
||||
: base_type( comp, a )
|
||||
const allocator_type& a )
|
||||
: base_type( comp, a )
|
||||
{
|
||||
BOOST_ASSERT( this->empty() );
|
||||
BOOST_ASSERT( this->empty() );
|
||||
}
|
||||
|
||||
template< class SizeType, class Hash, class Pred, class Allocator >
|
||||
@@ -377,7 +377,7 @@ namespace ptr_container_detail
|
||||
const Allocator& a )
|
||||
: base_type( n, hash, pred, a )
|
||||
{ }
|
||||
|
||||
|
||||
template< class Hash, class Pred, class Allocator >
|
||||
ptr_set_adapter( const Hash& hash,
|
||||
const Pred& pred,
|
||||
@@ -391,7 +391,7 @@ namespace ptr_container_detail
|
||||
{ }
|
||||
|
||||
template< class InputIterator, class Compare, class Allocator >
|
||||
ptr_set_adapter( InputIterator first, InputIterator last,
|
||||
ptr_set_adapter( InputIterator first, InputIterator last,
|
||||
const Compare& comp,
|
||||
const Allocator a = Allocator() )
|
||||
: base_type( comp, a )
|
||||
@@ -416,7 +416,7 @@ namespace ptr_container_detail
|
||||
explicit ptr_set_adapter( const ptr_set_adapter<U,Set,CA,b>& r )
|
||||
: base_type( r )
|
||||
{ }
|
||||
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
template< class PtrContainer >
|
||||
explicit ptr_set_adapter( std::auto_ptr<PtrContainer> clone )
|
||||
@@ -431,7 +431,7 @@ namespace ptr_container_detail
|
||||
#endif
|
||||
|
||||
template< class U, class Set, class CA, bool b >
|
||||
ptr_set_adapter& operator=( const ptr_set_adapter<U,Set,CA,b>& r )
|
||||
ptr_set_adapter& operator=( const ptr_set_adapter<U,Set,CA,b>& r )
|
||||
{
|
||||
base_type::operator=( r );
|
||||
return *this;
|
||||
@@ -452,16 +452,16 @@ namespace ptr_container_detail
|
||||
}
|
||||
#endif
|
||||
|
||||
std::pair<iterator,bool> insert( key_type* x ) // strong
|
||||
{
|
||||
std::pair<iterator,bool> insert( key_type* x ) // strong
|
||||
{
|
||||
this->enforce_null_policy( x, "Null pointer in 'ptr_set::insert()'" );
|
||||
|
||||
auto_type ptr( x, *this );
|
||||
|
||||
auto_type ptr( x, *this );
|
||||
std::pair<BOOST_DEDUCED_TYPENAME base_type::ptr_iterator,bool>
|
||||
res = this->base().insert( x );
|
||||
if( res.second )
|
||||
ptr.release();
|
||||
return std::make_pair( iterator( res.first ), res.second );
|
||||
res = this->base().insert( x );
|
||||
if( res.second )
|
||||
ptr.release();
|
||||
return std::make_pair( iterator( res.first ), res.second );
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
@@ -479,16 +479,16 @@ namespace ptr_container_detail
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
iterator insert( iterator where, key_type* x ) // strong
|
||||
{
|
||||
this->enforce_null_policy( x, "Null pointer in 'ptr_set::insert()'" );
|
||||
|
||||
auto_type ptr( x, *this );
|
||||
BOOST_DEDUCED_TYPENAME base_type::ptr_iterator
|
||||
auto_type ptr( x, *this );
|
||||
BOOST_DEDUCED_TYPENAME base_type::ptr_iterator
|
||||
res = this->base().insert( where.base(), x );
|
||||
if( *res == x )
|
||||
ptr.release();
|
||||
if( *res == x )
|
||||
ptr.release();
|
||||
return iterator( res);
|
||||
}
|
||||
|
||||
@@ -506,7 +506,7 @@ namespace ptr_container_detail
|
||||
return insert( where, x.release() );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
template< typename InputIterator >
|
||||
void insert( InputIterator first, InputIterator last ) // basic
|
||||
{
|
||||
@@ -514,8 +514,8 @@ namespace ptr_container_detail
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
#else
|
||||
|
||||
#else
|
||||
|
||||
template< class Range >
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
boost::disable_if< ptr_container_detail::is_pointer_or_integral<Range> >::type
|
||||
@@ -524,26 +524,26 @@ namespace ptr_container_detail
|
||||
insert( boost::begin(r), boost::end(r) );
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
template< class PtrSetAdapter >
|
||||
bool transfer( BOOST_DEDUCED_TYPENAME PtrSetAdapter::iterator object,
|
||||
bool transfer( BOOST_DEDUCED_TYPENAME PtrSetAdapter::iterator object,
|
||||
PtrSetAdapter& from ) // strong
|
||||
{
|
||||
return this->single_transfer( object, from );
|
||||
}
|
||||
|
||||
template< class PtrSetAdapter >
|
||||
size_type
|
||||
transfer( BOOST_DEDUCED_TYPENAME PtrSetAdapter::iterator first,
|
||||
BOOST_DEDUCED_TYPENAME PtrSetAdapter::iterator last,
|
||||
size_type
|
||||
transfer( BOOST_DEDUCED_TYPENAME PtrSetAdapter::iterator first,
|
||||
BOOST_DEDUCED_TYPENAME PtrSetAdapter::iterator last,
|
||||
PtrSetAdapter& from ) // basic
|
||||
{
|
||||
return this->single_transfer( first, last, from );
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
#else
|
||||
#else
|
||||
|
||||
template< class PtrSetAdapter, class Range >
|
||||
BOOST_DEDUCED_TYPENAME boost::disable_if< boost::is_same< Range,
|
||||
@@ -563,51 +563,51 @@ namespace ptr_container_detail
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// ptr_multiset_adapter
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template
|
||||
<
|
||||
<
|
||||
class Key,
|
||||
class VoidPtrMultiSet,
|
||||
class VoidPtrMultiSet,
|
||||
class CloneAllocator = heap_clone_allocator,
|
||||
bool Ordered = true
|
||||
bool Ordered = true
|
||||
>
|
||||
class ptr_multiset_adapter :
|
||||
class ptr_multiset_adapter :
|
||||
public ptr_container_detail::ptr_set_adapter_base<Key,VoidPtrMultiSet,CloneAllocator,Ordered>
|
||||
{
|
||||
typedef ptr_container_detail::ptr_set_adapter_base<Key,VoidPtrMultiSet,CloneAllocator,Ordered> base_type;
|
||||
|
||||
|
||||
public: // typedefs
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::iterator
|
||||
iterator;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::iterator
|
||||
iterator;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::size_type
|
||||
size_type;
|
||||
typedef Key key_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::auto_type
|
||||
auto_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME VoidPtrMultiSet::allocator_type
|
||||
allocator_type;
|
||||
allocator_type;
|
||||
private:
|
||||
template< typename II >
|
||||
void set_basic_clone_and_insert( II first, II last ) // basic
|
||||
{
|
||||
while( first != last )
|
||||
{
|
||||
insert( this->null_policy_allocate_clone_from_iterator( first ) ); // strong, commit
|
||||
++first;
|
||||
}
|
||||
}
|
||||
|
||||
template< typename II >
|
||||
void set_basic_clone_and_insert( II first, II last ) // basic
|
||||
{
|
||||
while( first != last )
|
||||
{
|
||||
insert( this->null_policy_allocate_clone_from_iterator( first ) ); // strong, commit
|
||||
++first;
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
ptr_multiset_adapter()
|
||||
{ }
|
||||
|
||||
template< class SizeType >
|
||||
ptr_multiset_adapter( SizeType n,
|
||||
ptr_multiset_adapter( SizeType n,
|
||||
ptr_container_detail::unordered_associative_container_tag tag )
|
||||
: base_type( n, tag )
|
||||
{ }
|
||||
@@ -615,7 +615,7 @@ namespace ptr_container_detail
|
||||
template< class Comp >
|
||||
explicit ptr_multiset_adapter( const Comp& comp,
|
||||
const allocator_type& a )
|
||||
: base_type( comp, a )
|
||||
: base_type( comp, a )
|
||||
{ }
|
||||
|
||||
template< class Hash, class Pred, class Allocator >
|
||||
@@ -629,12 +629,12 @@ namespace ptr_container_detail
|
||||
ptr_multiset_adapter( InputIterator first, InputIterator last )
|
||||
: base_type( first, last )
|
||||
{ }
|
||||
|
||||
|
||||
template< class InputIterator, class Comp >
|
||||
ptr_multiset_adapter( InputIterator first, InputIterator last,
|
||||
const Comp& comp,
|
||||
const allocator_type& a = allocator_type() )
|
||||
: base_type( comp, a )
|
||||
: base_type( comp, a )
|
||||
{
|
||||
set_basic_clone_and_insert( first, last );
|
||||
}
|
||||
@@ -646,12 +646,12 @@ namespace ptr_container_detail
|
||||
const Allocator& a )
|
||||
: base_type( first, last, hash, pred, a )
|
||||
{ }
|
||||
|
||||
|
||||
template< class U, class Set, class CA, bool b >
|
||||
explicit ptr_multiset_adapter( const ptr_multiset_adapter<U,Set,CA,b>& r )
|
||||
: base_type( r )
|
||||
{ }
|
||||
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
template< class PtrContainer >
|
||||
explicit ptr_multiset_adapter( std::auto_ptr<PtrContainer> clone )
|
||||
@@ -666,31 +666,31 @@ namespace ptr_container_detail
|
||||
#endif
|
||||
|
||||
template< class U, class Set, class CA, bool b >
|
||||
ptr_multiset_adapter& operator=( const ptr_multiset_adapter<U,Set,CA,b>& r )
|
||||
ptr_multiset_adapter& operator=( const ptr_multiset_adapter<U,Set,CA,b>& r )
|
||||
{
|
||||
base_type::operator=( r );
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
template< class T >
|
||||
void operator=( std::auto_ptr<T> r )
|
||||
void operator=( std::auto_ptr<T> r )
|
||||
{
|
||||
base_type::operator=( r );
|
||||
base_type::operator=( r );
|
||||
}
|
||||
#endif
|
||||
#ifndef BOOST_NO_CXX11_SMART_PTR
|
||||
template< class T >
|
||||
void operator=( std::unique_ptr<T> r )
|
||||
void operator=( std::unique_ptr<T> r )
|
||||
{
|
||||
base_type::operator=( std::move( r ) );
|
||||
base_type::operator=( std::move( r ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
iterator insert( iterator before, key_type* x ) // strong
|
||||
iterator insert( iterator before, key_type* x ) // strong
|
||||
{
|
||||
return base_type::insert( before, x );
|
||||
}
|
||||
return base_type::insert( before, x );
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
template< class U >
|
||||
@@ -706,16 +706,16 @@ namespace ptr_container_detail
|
||||
return insert( before, x.release() );
|
||||
}
|
||||
#endif
|
||||
|
||||
iterator insert( key_type* x ) // strong
|
||||
{
|
||||
|
||||
iterator insert( key_type* x ) // strong
|
||||
{
|
||||
this->enforce_null_policy( x, "Null pointer in 'ptr_multiset::insert()'" );
|
||||
|
||||
auto_type ptr( x, *this );
|
||||
|
||||
auto_type ptr( x, *this );
|
||||
BOOST_DEDUCED_TYPENAME base_type::ptr_iterator
|
||||
res = this->base().insert( x );
|
||||
ptr.release();
|
||||
return iterator( res );
|
||||
res = this->base().insert( x );
|
||||
ptr.release();
|
||||
return iterator( res );
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
@@ -732,7 +732,7 @@ namespace ptr_container_detail
|
||||
return insert( x.release() );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
template< typename InputIterator >
|
||||
void insert( InputIterator first, InputIterator last ) // basic
|
||||
{
|
||||
@@ -740,8 +740,8 @@ namespace ptr_container_detail
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
#else
|
||||
|
||||
#else
|
||||
|
||||
template< class Range >
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
boost::disable_if< ptr_container_detail::is_pointer_or_integral<Range> >::type
|
||||
@@ -753,23 +753,23 @@ namespace ptr_container_detail
|
||||
#endif
|
||||
|
||||
template< class PtrSetAdapter >
|
||||
void transfer( BOOST_DEDUCED_TYPENAME PtrSetAdapter::iterator object,
|
||||
void transfer( BOOST_DEDUCED_TYPENAME PtrSetAdapter::iterator object,
|
||||
PtrSetAdapter& from ) // strong
|
||||
{
|
||||
this->multi_transfer( object, from );
|
||||
}
|
||||
|
||||
template< class PtrSetAdapter >
|
||||
size_type transfer( BOOST_DEDUCED_TYPENAME PtrSetAdapter::iterator first,
|
||||
BOOST_DEDUCED_TYPENAME PtrSetAdapter::iterator last,
|
||||
size_type transfer( BOOST_DEDUCED_TYPENAME PtrSetAdapter::iterator first,
|
||||
BOOST_DEDUCED_TYPENAME PtrSetAdapter::iterator last,
|
||||
PtrSetAdapter& from ) // basic
|
||||
{
|
||||
return this->multi_transfer( first, last, from );
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
#else
|
||||
|
||||
#else
|
||||
|
||||
template< class PtrSetAdapter, class Range >
|
||||
BOOST_DEDUCED_TYPENAME boost::disable_if< boost::is_same< Range,
|
||||
BOOST_DEDUCED_TYPENAME PtrSetAdapter::iterator >, size_type >::type
|
||||
@@ -778,7 +778,7 @@ namespace ptr_container_detail
|
||||
return transfer( boost::begin(r), boost::end(r), from );
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
template< class PtrSetAdapter >
|
||||
void transfer( PtrSetAdapter& from ) // basic
|
||||
@@ -786,10 +786,10 @@ namespace ptr_container_detail
|
||||
transfer( from.begin(), from.end(), from );
|
||||
BOOST_ASSERT( from.empty() );
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
} // namespace 'boost'
|
||||
} // namespace 'boost'
|
||||
|
||||
#if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED)
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -27,18 +27,18 @@
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
class Key,
|
||||
class T,
|
||||
<
|
||||
class Key,
|
||||
class T,
|
||||
class Hash = boost::hash<Key>,
|
||||
class Pred = std::equal_to<Key>,
|
||||
class CloneAllocator = heap_clone_allocator,
|
||||
class Allocator = std::allocator< std::pair<const Key,
|
||||
typename ptr_container_detail::void_ptr<T>::type> >
|
||||
>
|
||||
class ptr_unordered_map :
|
||||
class ptr_unordered_map :
|
||||
public ptr_map_adapter<T,boost::unordered_map<Key,
|
||||
typename ptr_container_detail::void_ptr<T>::type,Hash,Pred,Allocator>,
|
||||
CloneAllocator,false>
|
||||
@@ -52,7 +52,7 @@ namespace boost
|
||||
|
||||
public:
|
||||
typedef typename base_type::size_type size_type;
|
||||
|
||||
|
||||
private:
|
||||
using base_type::lower_bound;
|
||||
using base_type::upper_bound;
|
||||
@@ -64,7 +64,7 @@ namespace boost
|
||||
using base_type::value_comp;
|
||||
using base_type::front;
|
||||
using base_type::back;
|
||||
|
||||
|
||||
public:
|
||||
using base_type::begin;
|
||||
using base_type::end;
|
||||
@@ -79,7 +79,7 @@ namespace boost
|
||||
using base_type::rehash;
|
||||
using base_type::key_eq;
|
||||
using base_type::hash_function;
|
||||
|
||||
|
||||
public:
|
||||
ptr_unordered_map()
|
||||
{ }
|
||||
@@ -87,29 +87,29 @@ namespace boost
|
||||
explicit ptr_unordered_map( size_type n )
|
||||
: base_type( n, ptr_container_detail::unordered_associative_container_tag() )
|
||||
{ }
|
||||
|
||||
|
||||
ptr_unordered_map( size_type n,
|
||||
const Hash& comp,
|
||||
const Pred& pred = Pred(),
|
||||
const Pred& pred = Pred(),
|
||||
const Allocator& a = Allocator() )
|
||||
: base_type( n, comp, pred, a )
|
||||
: base_type( n, comp, pred, a )
|
||||
{ }
|
||||
|
||||
template< typename InputIterator >
|
||||
ptr_unordered_map( InputIterator first, InputIterator last )
|
||||
: base_type( first, last )
|
||||
{ }
|
||||
|
||||
|
||||
template< typename InputIterator >
|
||||
ptr_unordered_map( InputIterator first, InputIterator last,
|
||||
const Hash& comp,
|
||||
const Pred& pred = Pred(),
|
||||
const Allocator& a = Allocator() )
|
||||
: base_type( first, last, comp, pred, a )
|
||||
: base_type( first, last, comp, pred, a )
|
||||
{ }
|
||||
|
||||
BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_unordered_map,
|
||||
base_type,
|
||||
BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_unordered_map,
|
||||
base_type,
|
||||
this_type )
|
||||
|
||||
template< class U >
|
||||
@@ -122,19 +122,19 @@ namespace boost
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
class Key,
|
||||
class T,
|
||||
<
|
||||
class Key,
|
||||
class T,
|
||||
class Hash = boost::hash<Key>,
|
||||
class Pred = std::equal_to<Key>,
|
||||
class CloneAllocator = heap_clone_allocator,
|
||||
class Allocator = std::allocator< std::pair<const Key,void*> >
|
||||
>
|
||||
class ptr_unordered_multimap :
|
||||
class ptr_unordered_multimap :
|
||||
public ptr_multimap_adapter<T,boost::unordered_multimap<Key,void*,Hash,Pred,Allocator>,
|
||||
CloneAllocator,false>
|
||||
{
|
||||
@@ -146,7 +146,7 @@ namespace boost
|
||||
|
||||
public:
|
||||
typedef typename base_type::size_type size_type;
|
||||
|
||||
|
||||
private:
|
||||
using base_type::lower_bound;
|
||||
using base_type::upper_bound;
|
||||
@@ -158,7 +158,7 @@ namespace boost
|
||||
using base_type::value_comp;
|
||||
using base_type::front;
|
||||
using base_type::back;
|
||||
|
||||
|
||||
public:
|
||||
using base_type::begin;
|
||||
using base_type::end;
|
||||
@@ -173,7 +173,7 @@ namespace boost
|
||||
using base_type::rehash;
|
||||
using base_type::key_eq;
|
||||
using base_type::hash_function;
|
||||
|
||||
|
||||
public:
|
||||
ptr_unordered_multimap()
|
||||
{ }
|
||||
@@ -181,29 +181,29 @@ namespace boost
|
||||
explicit ptr_unordered_multimap( size_type n )
|
||||
: base_type( n, ptr_container_detail::unordered_associative_container_tag() )
|
||||
{ }
|
||||
|
||||
|
||||
ptr_unordered_multimap( size_type n,
|
||||
const Hash& comp,
|
||||
const Pred& pred = Pred(),
|
||||
const Pred& pred = Pred(),
|
||||
const Allocator& a = Allocator() )
|
||||
: base_type( n, comp, pred, a )
|
||||
: base_type( n, comp, pred, a )
|
||||
{ }
|
||||
|
||||
template< typename InputIterator >
|
||||
ptr_unordered_multimap( InputIterator first, InputIterator last )
|
||||
: base_type( first, last )
|
||||
{ }
|
||||
|
||||
|
||||
template< typename InputIterator >
|
||||
ptr_unordered_multimap( InputIterator first, InputIterator last,
|
||||
const Hash& comp,
|
||||
const Pred& pred = Pred(),
|
||||
const Allocator& a = Allocator() )
|
||||
: base_type( first, last, comp, pred, a )
|
||||
: base_type( first, last, comp, pred, a )
|
||||
{ }
|
||||
|
||||
BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_unordered_multimap,
|
||||
base_type,
|
||||
BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_unordered_multimap,
|
||||
base_type,
|
||||
this_type )
|
||||
|
||||
template< class U >
|
||||
@@ -216,19 +216,19 @@ namespace boost
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// clonability
|
||||
|
||||
template< class K, class T, class H, class P, class CA, class A >
|
||||
inline ptr_unordered_map<K,T,H,P,CA,A>*
|
||||
inline ptr_unordered_map<K,T,H,P,CA,A>*
|
||||
new_clone( const ptr_unordered_map<K,T,H,P,CA,A>& r )
|
||||
{
|
||||
return r.clone().release();
|
||||
}
|
||||
|
||||
template< class K, class T, class H, class P, class CA, class A >
|
||||
inline ptr_unordered_multimap<K,T,H,P,CA,A>*
|
||||
inline ptr_unordered_multimap<K,T,H,P,CA,A>*
|
||||
new_clone( const ptr_unordered_multimap<K,T,H,P,CA,A>& r )
|
||||
{
|
||||
return r.clone().release();
|
||||
@@ -238,14 +238,14 @@ namespace boost
|
||||
// swap
|
||||
|
||||
template< class K, class T, class H, class P, class CA, class A >
|
||||
inline void swap( ptr_unordered_map<K,T,H,P,CA,A>& l,
|
||||
inline void swap( ptr_unordered_map<K,T,H,P,CA,A>& l,
|
||||
ptr_unordered_map<K,T,H,P,CA,A>& r )
|
||||
{
|
||||
l.swap(r);
|
||||
}
|
||||
|
||||
template< class K, class T, class H, class P, class CA, class A >
|
||||
inline void swap( ptr_unordered_multimap<K,T,H,P,CA,A>& l,
|
||||
inline void swap( ptr_unordered_multimap<K,T,H,P,CA,A>& l,
|
||||
ptr_unordered_multimap<K,T,H,P,CA,A>& r )
|
||||
{
|
||||
l.swap(r);
|
||||
|
||||
@@ -30,14 +30,14 @@ namespace boost
|
||||
{
|
||||
|
||||
template
|
||||
<
|
||||
class Key,
|
||||
<
|
||||
class Key,
|
||||
class Hash = boost::hash<Key>,
|
||||
class Pred = std::equal_to<Key>,
|
||||
class CloneAllocator = heap_clone_allocator,
|
||||
class Allocator = std::allocator< typename ptr_container_detail::void_ptr<Key>::type >
|
||||
>
|
||||
class ptr_unordered_set :
|
||||
class ptr_unordered_set :
|
||||
public ptr_set_adapter< Key, boost::unordered_set<
|
||||
typename ptr_container_detail::void_ptr<Key>::type,
|
||||
void_ptr_indirect_fun<Hash,Key>,
|
||||
@@ -67,7 +67,7 @@ namespace boost
|
||||
using base_type::value_comp;
|
||||
using base_type::front;
|
||||
using base_type::back;
|
||||
|
||||
|
||||
public:
|
||||
using base_type::begin;
|
||||
using base_type::end;
|
||||
@@ -82,7 +82,7 @@ namespace boost
|
||||
using base_type::rehash;
|
||||
using base_type::key_eq;
|
||||
using base_type::hash_function;
|
||||
|
||||
|
||||
public:
|
||||
ptr_unordered_set()
|
||||
{}
|
||||
@@ -90,12 +90,12 @@ namespace boost
|
||||
explicit ptr_unordered_set( size_type n )
|
||||
: base_type( n, ptr_container_detail::unordered_associative_container_tag() )
|
||||
{ }
|
||||
|
||||
|
||||
ptr_unordered_set( size_type n,
|
||||
const Hash& comp,
|
||||
const Pred& pred = Pred(),
|
||||
const Pred& pred = Pred(),
|
||||
const Allocator& a = Allocator() )
|
||||
: base_type( n, comp, pred, a )
|
||||
: base_type( n, comp, pred, a )
|
||||
{ }
|
||||
|
||||
template< typename InputIterator >
|
||||
@@ -108,34 +108,34 @@ namespace boost
|
||||
const Hash& comp,
|
||||
const Pred& pred = Pred(),
|
||||
const Allocator& a = Allocator() )
|
||||
: base_type( first, last, comp, pred, a )
|
||||
: base_type( first, last, comp, pred, a )
|
||||
{ }
|
||||
|
||||
BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_unordered_set,
|
||||
base_type,
|
||||
this_type )
|
||||
|
||||
BOOST_PTR_CONTAINER_DEFINE_COPY_CONSTRUCTORS( ptr_unordered_set,
|
||||
|
||||
BOOST_PTR_CONTAINER_DEFINE_COPY_CONSTRUCTORS( ptr_unordered_set,
|
||||
base_type )
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
class Key,
|
||||
<
|
||||
class Key,
|
||||
class Hash = boost::hash<Key>,
|
||||
class Pred = std::equal_to<Key>,
|
||||
class CloneAllocator = heap_clone_allocator,
|
||||
class Allocator = std::allocator<void*>
|
||||
>
|
||||
class ptr_unordered_multiset :
|
||||
public ptr_multiset_adapter< Key,
|
||||
class ptr_unordered_multiset :
|
||||
public ptr_multiset_adapter< Key,
|
||||
boost::unordered_multiset<void*,void_ptr_indirect_fun<Hash,Key>,
|
||||
void_ptr_indirect_fun<Pred,Key>,Allocator>,
|
||||
CloneAllocator, false >
|
||||
{
|
||||
typedef ptr_multiset_adapter< Key,
|
||||
typedef ptr_multiset_adapter< Key,
|
||||
boost::unordered_multiset<void*,void_ptr_indirect_fun<Hash,Key>,
|
||||
void_ptr_indirect_fun<Pred,Key>,Allocator>,
|
||||
CloneAllocator, false >
|
||||
@@ -156,7 +156,7 @@ namespace boost
|
||||
using base_type::value_comp;
|
||||
using base_type::front;
|
||||
using base_type::back;
|
||||
|
||||
|
||||
public:
|
||||
using base_type::begin;
|
||||
using base_type::end;
|
||||
@@ -171,20 +171,20 @@ namespace boost
|
||||
using base_type::rehash;
|
||||
using base_type::key_eq;
|
||||
using base_type::hash_function;
|
||||
|
||||
|
||||
public:
|
||||
ptr_unordered_multiset()
|
||||
{ }
|
||||
|
||||
|
||||
explicit ptr_unordered_multiset( size_type n )
|
||||
: base_type( n, ptr_container_detail::unordered_associative_container_tag() )
|
||||
: base_type( n, ptr_container_detail::unordered_associative_container_tag() )
|
||||
{ }
|
||||
|
||||
ptr_unordered_multiset( size_type n,
|
||||
const Hash& comp,
|
||||
const Pred& pred = Pred(),
|
||||
const Pred& pred = Pred(),
|
||||
const Allocator& a = Allocator() )
|
||||
: base_type( n, comp, pred, a )
|
||||
: base_type( n, comp, pred, a )
|
||||
{ }
|
||||
|
||||
template< typename InputIterator >
|
||||
@@ -197,15 +197,15 @@ namespace boost
|
||||
const Hash& comp,
|
||||
const Pred& pred = Pred(),
|
||||
const Allocator& a = Allocator() )
|
||||
: base_type( first, last, comp, pred, a )
|
||||
: base_type( first, last, comp, pred, a )
|
||||
{ }
|
||||
|
||||
BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_unordered_multiset,
|
||||
BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_unordered_multiset,
|
||||
base_type,
|
||||
this_type )
|
||||
|
||||
BOOST_PTR_CONTAINER_DEFINE_COPY_CONSTRUCTORS( ptr_unordered_multiset,
|
||||
base_type )
|
||||
|
||||
BOOST_PTR_CONTAINER_DEFINE_COPY_CONSTRUCTORS( ptr_unordered_multiset,
|
||||
base_type )
|
||||
|
||||
};
|
||||
|
||||
@@ -213,31 +213,31 @@ namespace boost
|
||||
// clonability
|
||||
|
||||
template< typename K, typename H, typename P, typename CA, typename A >
|
||||
inline ptr_unordered_set<K,H,P,CA,A>*
|
||||
inline ptr_unordered_set<K,H,P,CA,A>*
|
||||
new_clone( const ptr_unordered_set<K,H,P,CA,A>& r )
|
||||
{
|
||||
return r.clone().release();
|
||||
}
|
||||
|
||||
template< typename K, typename H, typename P, typename CA, typename A >
|
||||
inline ptr_unordered_multiset<K,H,P,CA,A>*
|
||||
inline ptr_unordered_multiset<K,H,P,CA,A>*
|
||||
new_clone( const ptr_unordered_multiset<K,H,P,CA,A>& r )
|
||||
{
|
||||
return r.clone().release();
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// swap
|
||||
|
||||
template< typename K, typename H, typename P, typename CA, typename A >
|
||||
inline void swap( ptr_unordered_set<K,H,P,CA,A>& l,
|
||||
inline void swap( ptr_unordered_set<K,H,P,CA,A>& l,
|
||||
ptr_unordered_set<K,H,P,CA,A>& r )
|
||||
{
|
||||
l.swap(r);
|
||||
}
|
||||
|
||||
template< typename K, typename H, typename P, typename CA, typename A >
|
||||
inline void swap( ptr_unordered_multiset<K,H,P,CA,A>& l,
|
||||
inline void swap( ptr_unordered_multiset<K,H,P,CA,A>& l,
|
||||
ptr_unordered_multiset<K,H,P,CA,A>& r )
|
||||
{
|
||||
l.swap(r);
|
||||
|
||||
@@ -31,12 +31,12 @@ namespace boost
|
||||
{
|
||||
|
||||
template
|
||||
<
|
||||
class T,
|
||||
<
|
||||
class T,
|
||||
class CloneAllocator = heap_clone_allocator,
|
||||
class Allocator = void
|
||||
>
|
||||
class ptr_vector : public
|
||||
class ptr_vector : public
|
||||
ptr_sequence_adapter< T,
|
||||
std::vector<
|
||||
typename ptr_container_detail::void_ptr<T>::type,
|
||||
@@ -44,7 +44,7 @@ namespace boost
|
||||
std::allocator<typename ptr_container_detail::void_ptr<T>::type>, Allocator>::type
|
||||
>,
|
||||
CloneAllocator >
|
||||
{
|
||||
{
|
||||
typedef
|
||||
|
||||
ptr_sequence_adapter< T,
|
||||
@@ -58,19 +58,19 @@ namespace boost
|
||||
base_class;
|
||||
|
||||
typedef ptr_vector<T,CloneAllocator,Allocator> this_type;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
BOOST_PTR_CONTAINER_DEFINE_SEQEUENCE_MEMBERS( ptr_vector,
|
||||
BOOST_PTR_CONTAINER_DEFINE_SEQEUENCE_MEMBERS( ptr_vector,
|
||||
base_class,
|
||||
this_type )
|
||||
|
||||
|
||||
explicit ptr_vector( size_type n,
|
||||
const allocator_type& alloc = allocator_type() )
|
||||
: base_class(alloc)
|
||||
{
|
||||
this->base().reserve( n );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@@ -90,7 +90,7 @@ namespace boost
|
||||
{
|
||||
l.swap(r);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED)
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
#include <boost/ptr_container/detail/serialize_reversible_cont.hpp>
|
||||
#include <boost/ptr_container/ptr_array.hpp>
|
||||
|
||||
namespace boost
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace serialization
|
||||
namespace serialization
|
||||
{
|
||||
|
||||
template<class Archive, class T, std::size_t N, class CloneAllocator>
|
||||
@@ -26,7 +26,7 @@ void load(Archive& ar, ptr_array<T, N, CloneAllocator>& c, unsigned int /*versio
|
||||
{
|
||||
typedef ptr_array<T, N, CloneAllocator> container_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME container_type::size_type size_type;
|
||||
|
||||
|
||||
for(size_type i = 0u; i != N; ++i)
|
||||
{
|
||||
T* p;
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
#include <boost/ptr_container/detail/serialize_reversible_cont.hpp>
|
||||
#include <boost/ptr_container/ptr_circular_buffer.hpp>
|
||||
|
||||
namespace boost
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace serialization
|
||||
namespace serialization
|
||||
{
|
||||
|
||||
template<class Archive, class T, class CloneAllocator, class Allocator>
|
||||
@@ -26,11 +26,11 @@ void load(Archive& ar, ptr_circular_buffer<T, CloneAllocator, Allocator>& c, uns
|
||||
{
|
||||
typedef ptr_circular_buffer<T, CloneAllocator, Allocator> container_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME container_type::size_type size_type;
|
||||
|
||||
|
||||
size_type n;
|
||||
ar >> boost::serialization::make_nvp( ptr_container_detail::count(), n );
|
||||
c.reserve(n);
|
||||
|
||||
|
||||
ptr_container_detail::load_helper(ar, c, n);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
#include <boost/ptr_container/detail/serialize_reversible_cont.hpp>
|
||||
#include <boost/ptr_container/ptr_deque.hpp>
|
||||
|
||||
namespace boost
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace serialization
|
||||
namespace serialization
|
||||
{
|
||||
|
||||
template<class Archive, class T, class CloneAllocator, class Allocator>
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
#include <boost/ptr_container/detail/serialize_reversible_cont.hpp>
|
||||
#include <boost/ptr_container/ptr_list.hpp>
|
||||
|
||||
namespace boost
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace serialization
|
||||
namespace serialization
|
||||
{
|
||||
|
||||
template<class Archive, class T, class CloneAllocator, class Allocator>
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
#include <boost/ptr_container/detail/serialize_ptr_map_adapter.hpp>
|
||||
#include <boost/ptr_container/ptr_map.hpp>
|
||||
|
||||
namespace boost
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace serialization
|
||||
namespace serialization
|
||||
{
|
||||
|
||||
template<class Archive, class Key, class T, class Compare, class CloneAllocator, class Allocator>
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
#include <boost/ptr_container/detail/serialize_reversible_cont.hpp>
|
||||
#include <boost/ptr_container/ptr_set.hpp>
|
||||
|
||||
namespace boost
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace serialization
|
||||
namespace serialization
|
||||
{
|
||||
|
||||
template<class Archive, class T, class CloneAllocator, class Allocator>
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
#include <boost/ptr_container/detail/serialize_ptr_map_adapter.hpp>
|
||||
#include <boost/ptr_container/ptr_unordered_map.hpp>
|
||||
|
||||
namespace boost
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace serialization
|
||||
namespace serialization
|
||||
{
|
||||
|
||||
template<class Archive, class Key, class T, class Hash, class Pred, class CloneAllocator, class Allocator>
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
#include <boost/ptr_container/detail/serialize_reversible_cont.hpp>
|
||||
#include <boost/ptr_container/ptr_unordered_set.hpp>
|
||||
|
||||
namespace boost
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace serialization
|
||||
namespace serialization
|
||||
{
|
||||
|
||||
template<class Archive, class T, class Hash, class Pred, class CloneAllocator, class Allocator>
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
#include <boost/ptr_container/detail/serialize_reversible_cont.hpp>
|
||||
#include <boost/ptr_container/ptr_vector.hpp>
|
||||
|
||||
namespace boost
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace serialization
|
||||
namespace serialization
|
||||
{
|
||||
|
||||
template<class Archive, class T, class CloneAllocator, class Allocator>
|
||||
@@ -20,11 +20,11 @@ void load(Archive& ar, ptr_vector<T, CloneAllocator, Allocator>& c, unsigned int
|
||||
{
|
||||
typedef ptr_vector<T, CloneAllocator, Allocator> container_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME container_type::size_type size_type;
|
||||
|
||||
|
||||
size_type n;
|
||||
ar >> boost::serialization::make_nvp( ptr_container_detail::count(), n );
|
||||
c.reserve(n);
|
||||
|
||||
|
||||
ptr_container_detail::load_helper(ar, c, n);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user