update to support circular_buffer
[SVN r46321]
This commit is contained in:
parent
1441b1ae34
commit
51b7c3853a
@ -347,10 +347,42 @@ namespace ptr_container_detail
|
||||
}
|
||||
|
||||
public:
|
||||
using base_type::begin;
|
||||
using base_type::end;
|
||||
using base_type::cbegin;
|
||||
using base_type::cend;
|
||||
#if BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(70190006))
|
||||
iterator begin()
|
||||
{
|
||||
return base_type::begin();
|
||||
}
|
||||
|
||||
const_iterator begin() const
|
||||
{
|
||||
return base_type::begin();
|
||||
}
|
||||
|
||||
iterator end()
|
||||
{
|
||||
return base_type::end();
|
||||
}
|
||||
|
||||
const_iterator end() const
|
||||
{
|
||||
return base_type::end();
|
||||
}
|
||||
|
||||
const_iterator cbegin() const
|
||||
{
|
||||
return base_type::cbegin();
|
||||
}
|
||||
|
||||
const_iterator cend() const
|
||||
{
|
||||
return base_type::cend();
|
||||
}
|
||||
#else
|
||||
using base_type::begin;
|
||||
using base_type::end;
|
||||
using base_type::cbegin;
|
||||
using base_type::cend;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
local_iterator begin( size_type n )
|
||||
|
@ -67,6 +67,7 @@ namespace ptr_container_detail
|
||||
struct is_pointer_or_integral_tag {};
|
||||
struct is_range_tag {};
|
||||
struct sequence_tag {};
|
||||
struct fixed_length_sequence_tag : sequence_tag {};
|
||||
struct associative_container_tag {};
|
||||
struct ordered_associative_container_tag : associative_container_tag {};
|
||||
struct unordered_associative_container_tag : associative_container_tag {};
|
||||
@ -313,10 +314,21 @@ namespace ptr_container_detail
|
||||
reversible_ptr_container( SizeType n, unordered_associative_container_tag )
|
||||
: c_( n )
|
||||
{ }
|
||||
|
||||
template< class SizeType >
|
||||
reversible_ptr_container( SizeType n, fixed_length_sequence_tag )
|
||||
: c_( n )
|
||||
{ }
|
||||
|
||||
template< class SizeType >
|
||||
reversible_ptr_container( SizeType n, const allocator_type& a,
|
||||
fixed_length_sequence_tag )
|
||||
: c_( n, a )
|
||||
{ }
|
||||
|
||||
explicit reversible_ptr_container( const allocator_type& a )
|
||||
: c_( a )
|
||||
{}
|
||||
{ }
|
||||
|
||||
template< class PtrContainer >
|
||||
explicit reversible_ptr_container( std::auto_ptr<PtrContainer> clone )
|
||||
@ -335,7 +347,6 @@ namespace ptr_container_detail
|
||||
constructor_impl( r.begin(), r.end(), std::forward_iterator_tag() );
|
||||
}
|
||||
|
||||
|
||||
template< class PtrContainer >
|
||||
reversible_ptr_container& operator=( std::auto_ptr<PtrContainer> clone ) // nothrow
|
||||
{
|
||||
@ -379,6 +390,31 @@ namespace ptr_container_detail
|
||||
const allocator_type& a )
|
||||
: c_( comp, a ) {}
|
||||
|
||||
template< class ForwardIterator >
|
||||
reversible_ptr_container( ForwardIterator first,
|
||||
ForwardIterator last,
|
||||
fixed_length_sequence_tag )
|
||||
: c_( std::distance(first,last) )
|
||||
{
|
||||
constructor_impl( first, last,
|
||||
std::forward_iterator_tag() );
|
||||
}
|
||||
|
||||
template< class SizeType, class InputIterator >
|
||||
reversible_ptr_container( SizeType n,
|
||||
InputIterator first,
|
||||
InputIterator last,
|
||||
fixed_length_sequence_tag )
|
||||
: c_( n )
|
||||
{
|
||||
constructor_impl( first, last,
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
#else
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
#endif
|
||||
iterator_category<InputIterator>::type() );
|
||||
}
|
||||
|
||||
template< class InputIterator >
|
||||
reversible_ptr_container( InputIterator first,
|
||||
InputIterator last,
|
||||
@ -661,7 +697,6 @@ namespace ptr_container_detail
|
||||
|
||||
#define BOOST_PTR_CONTAINER_DEFINE_COPY_CONSTRUCTORS( PC, base_type ) \
|
||||
\
|
||||
template< class U > \
|
||||
explicit PC( const PC& r ) : base_type( r ) { } \
|
||||
\
|
||||
template< class U > \
|
||||
|
@ -48,12 +48,65 @@ namespace boost
|
||||
typedef typename base_type::size_type size_type;
|
||||
typedef typename base_type::allocator_type allocator_type;
|
||||
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 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;
|
||||
|
||||
public: // constructors
|
||||
ptr_circular_buffer()
|
||||
{ }
|
||||
|
||||
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() )
|
||||
{ }
|
||||
|
||||
template< class ForwardIterator >
|
||||
ptr_circular_buffer( ForwardIterator first, ForwardIterator last )
|
||||
: base_type( first, last, ptr_container_detail::fixed_length_sequence_tag() )
|
||||
{ }
|
||||
|
||||
template< class InputIterator >
|
||||
ptr_circular_buffer( capacity_type n, InputIterator first, InputIterator last )
|
||||
: base_type( n, first, last, ptr_container_detail::fixed_length_sequence_tag() )
|
||||
{ }
|
||||
|
||||
explicit ptr_circular_buffer( const ptr_circular_buffer& r )
|
||||
: base_type( r.size(), r.begin(), r.end(),
|
||||
ptr_container_detail::fixed_length_sequence_tag() )
|
||||
{ }
|
||||
|
||||
template< class U >
|
||||
explicit ptr_circular_buffer( const ptr_circular_buffer<U>& r )
|
||||
: base_type( r.size(), r.begin(), r.end(),
|
||||
ptr_container_detail::fixed_length_sequence_tag() )
|
||||
{ }
|
||||
|
||||
ptr_circular_buffer& operator=( const ptr_circular_buffer& r )
|
||||
{
|
||||
ptr_circular_buffer clone( r );
|
||||
clone.swap( *this );
|
||||
return *this;
|
||||
}
|
||||
|
||||
template< class U >
|
||||
ptr_circular_buffer& operator=( const ptr_circular_buffer<U>& r )
|
||||
{
|
||||
ptr_circular_buffer clone( r );
|
||||
clone.swap( *this );
|
||||
return *this;
|
||||
}
|
||||
|
||||
BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_circular_buffer,
|
||||
base_type, this_type );
|
||||
|
||||
public: // allocators
|
||||
allocator_type& get_allocator()
|
||||
{
|
||||
@ -69,30 +122,30 @@ namespace boost
|
||||
array_range array_one() // nothrow
|
||||
{
|
||||
typename circular_buffer_type::array_range r = this->base().array_one();
|
||||
return array_range( static_cast<pointer>(r.first,r.second) );
|
||||
return array_range( reinterpret_cast<pointer>(r.first), r.second );
|
||||
}
|
||||
|
||||
const_array_range array_one() const // nothrow
|
||||
{
|
||||
typename circular_buffer_type::const_array_range r = this->base().array_one();
|
||||
return array_range( static_cast<pointer>(r.first,r.second) );
|
||||
return const_array_range( reinterpret_cast<const_pointer>(r.first), r.second );
|
||||
}
|
||||
|
||||
array_range array_two() // nothrow
|
||||
{
|
||||
typename circular_buffer_type::const_array_range r = this->base().array_two();
|
||||
return const_array_range( static_cast<pointer>(r.first,r.second) );
|
||||
typename circular_buffer_type::array_range r = this->base().array_two();
|
||||
return array_range( reinterpret_cast<pointer>(r.first), r.second );
|
||||
}
|
||||
|
||||
const_array_range array_two() const // nothrow
|
||||
{
|
||||
typename circular_buffer_type::const_array_range r = this->base().array_two();
|
||||
return const_array_range( static_cast<pointer>(r.first,r.second) );
|
||||
return const_array_range( reinterpret_cast<const_pointer>(r.first), r.second );
|
||||
}
|
||||
|
||||
pointer linearise() // nothrow
|
||||
pointer linearize() // nothrow
|
||||
{
|
||||
return this->base().linearise();
|
||||
return reinterpret_cast<pointer>(this->base().linearize());
|
||||
}
|
||||
|
||||
bool full() const // nothrow
|
||||
@ -105,6 +158,12 @@ namespace boost
|
||||
return this->base().reserve();
|
||||
}
|
||||
|
||||
void reserve( size_type n ) // strong
|
||||
{
|
||||
if( capacity() < n )
|
||||
set_capacity( n );
|
||||
}
|
||||
|
||||
capacity_type capacity() const // nothrow
|
||||
{
|
||||
return this->base().capacity();
|
||||
@ -129,22 +188,99 @@ namespace boost
|
||||
this->base().rset_capacity( new_capacity );
|
||||
}
|
||||
|
||||
using base_type::assign;
|
||||
void resize( size_type size ) // basic
|
||||
{
|
||||
size_type old_size = this->size();
|
||||
if( old_size > size )
|
||||
{
|
||||
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 );
|
||||
}
|
||||
|
||||
BOOST_ASSERT( this->size() == size );
|
||||
}
|
||||
|
||||
void resize( size_type size, value_type to_clone ) // basic
|
||||
{
|
||||
size_type old_size = this->size();
|
||||
if( old_size > size )
|
||||
{
|
||||
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 ) );
|
||||
}
|
||||
|
||||
BOOST_ASSERT( this->size() == size );
|
||||
}
|
||||
|
||||
void rresize( size_type size ) // basic
|
||||
{
|
||||
size_type old_size = this->size();
|
||||
if( 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 );
|
||||
}
|
||||
|
||||
BOOST_ASSERT( this->size() == size );
|
||||
}
|
||||
|
||||
void rresize( size_type size, value_type to_clone ) // basic
|
||||
{
|
||||
size_type old_size = this->size();
|
||||
if( 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 ) );
|
||||
}
|
||||
|
||||
BOOST_ASSERT( this->size() == size );
|
||||
}
|
||||
|
||||
template< class InputIterator >
|
||||
void assign( InputIterator first, InputIterator last ) // strong
|
||||
{
|
||||
ptr_circular_buffer temp( first, last );
|
||||
this->swap( temp );
|
||||
}
|
||||
|
||||
template< class Range >
|
||||
void assign( const Range& r ) // strong
|
||||
{
|
||||
assign( boost::begin(r), boost::end(r ) );
|
||||
}
|
||||
|
||||
void assign( size_type n, value_type to_clone ) // strong
|
||||
{
|
||||
base_type temp;
|
||||
ptr_circular_buffer temp( n );
|
||||
for( size_type i = 0u; i != n; ++i )
|
||||
temp.push_back( this->null_policy_allocate_clone( to_clone ) );
|
||||
temp->base().set_capacity( n );
|
||||
this->swap( temp );
|
||||
}
|
||||
|
||||
void assign( capacity_type capacity, size_type n,
|
||||
value_type to_clone ) // basic
|
||||
{
|
||||
this->assign( n, to_clone );
|
||||
this->base().set_capacity( capacity );
|
||||
this->assign( std::min(n,capacity), to_clone );
|
||||
}
|
||||
|
||||
template< class InputIterator >
|
||||
@ -152,12 +288,14 @@ namespace boost
|
||||
InputIterator first, InputIterator last ) // basic
|
||||
{
|
||||
this->assign( first, last );
|
||||
this->base().set_capacity( capacity );
|
||||
this->set_capacity( capacity );
|
||||
}
|
||||
|
||||
void push_back( value_type ptr ) // nothrow
|
||||
{
|
||||
BOOST_ASSERT( capacity() > 0 );
|
||||
BOOST_ASSERT( capacity() > 0 );
|
||||
this->enforce_null_policy( ptr, "Null pointer in 'push_back()'" );
|
||||
|
||||
auto_type old_ptr;
|
||||
if( full() )
|
||||
old_ptr.reset( &*this->begin() );
|
||||
@ -173,10 +311,12 @@ namespace boost
|
||||
void push_front( value_type ptr ) // nothrow
|
||||
{
|
||||
BOOST_ASSERT( capacity() > 0 );
|
||||
this->enforce_null_policy( ptr, "Null pointer in 'push_front()'" );
|
||||
|
||||
auto_type old_ptr;
|
||||
if( full() )
|
||||
old_ptr.reset( &*(--this->end()) );
|
||||
this->base().push_back( ptr );
|
||||
this->base().push_front( ptr );
|
||||
}
|
||||
|
||||
template< class U >
|
||||
@ -188,6 +328,8 @@ namespace boost
|
||||
iterator insert( iterator pos, value_type ptr ) // nothrow
|
||||
{
|
||||
BOOST_ASSERT( capacity() > 0 );
|
||||
this->enforce_null_policy( ptr, "Null pointer in 'insert()'" );
|
||||
|
||||
auto_type new_ptr( ptr );
|
||||
iterator b = this->begin();
|
||||
if( full() && pos == b )
|
||||
@ -208,9 +350,10 @@ namespace boost
|
||||
}
|
||||
|
||||
template< class InputIterator >
|
||||
void insert( iterator pos, InputIterator first, InputIterator last )
|
||||
void insert( iterator pos, InputIterator first, InputIterator last ) // basic
|
||||
{
|
||||
// @todo
|
||||
for( ; first != last; ++first, ++pos )
|
||||
pos = insert( pos, this->null_policy_allocate_clone( &*first ) );
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
@ -228,6 +371,8 @@ namespace boost
|
||||
iterator rinsert( iterator pos, value_type ptr ) // nothrow
|
||||
{
|
||||
BOOST_ASSERT( capacity() > 0 );
|
||||
this->enforce_null_policy( ptr, "Null pointer in 'rinsert()'" );
|
||||
|
||||
auto_type new_ptr( ptr );
|
||||
iterator b = this->end();
|
||||
if (full() && pos == b)
|
||||
@ -249,9 +394,10 @@ namespace boost
|
||||
|
||||
|
||||
template< class InputIterator >
|
||||
void rinsert( iterator pos, InputIterator first, InputIterator last )
|
||||
void rinsert( iterator pos, InputIterator first, InputIterator last ) // basic
|
||||
{
|
||||
// @todo
|
||||
for( ; first != last; ++first, ++pos )
|
||||
pos = rinsert( pos, this->null_policy_allocate_clone( &*first ) );
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
@ -266,29 +412,109 @@ namespace boost
|
||||
|
||||
#endif
|
||||
|
||||
void rerase( iterator pos )
|
||||
iterator rerase( iterator pos ) // nothrow
|
||||
{
|
||||
// @todo
|
||||
BOOST_ASSERT( !this->empty() );
|
||||
BOOST_ASSERT( pos != this->end() );
|
||||
|
||||
this->remove( pos );
|
||||
return iterator( this->base().rerase( pos.base() ) );
|
||||
}
|
||||
|
||||
void rerase( iterator first, iterator last )
|
||||
iterator rerase( iterator first, iterator last ) // nothrow
|
||||
{
|
||||
// @todo
|
||||
this->remove( first, last );
|
||||
return iterator( this->base().rerase( first.base(),
|
||||
last.base() ) );
|
||||
}
|
||||
|
||||
|
||||
public: // constructors
|
||||
|
||||
BOOST_PTR_CONTAINER_DEFINE_SEQEUENCE_MEMBERS( ptr_circular_buffer,
|
||||
base_type,
|
||||
this_type );
|
||||
|
||||
explicit ptr_circular_buffer( capacity_type n,
|
||||
const allocator_type& alloc = allocator_type() )
|
||||
: base_type(alloc)
|
||||
template< class Range >
|
||||
iterator rerase( const Range& r ) // nothrow
|
||||
{
|
||||
this->base().set_capacity( n );
|
||||
}
|
||||
return rerase( boost::begin(r), boost::end(r) );
|
||||
}
|
||||
|
||||
void rotate( const_iterator new_begin ) // nothrow
|
||||
{
|
||||
this->base().rotate( new_begin.base() );
|
||||
}
|
||||
|
||||
public: // transfer
|
||||
template< class PtrSeqAdapter >
|
||||
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;
|
||||
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,
|
||||
PtrSeqAdapter& from ) // nothrow
|
||||
{
|
||||
BOOST_ASSERT( (void*)&from != (void*)this );
|
||||
if( from.empty() )
|
||||
return;
|
||||
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
|
||||
transfer( iterator before, const Range& r, PtrSeqAdapter& from ) // nothrow
|
||||
{
|
||||
transfer( before, boost::begin(r), boost::end(r), from );
|
||||
}
|
||||
|
||||
#endif
|
||||
template< class PtrSeqAdapter >
|
||||
void transfer( iterator before, PtrSeqAdapter& from ) // nothrow
|
||||
{
|
||||
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
|
||||
{
|
||||
BOOST_ASSERT( from != 0 );
|
||||
if( delete_from )
|
||||
{
|
||||
BOOST_DEDUCED_TYPENAME base_type::scoped_deleter
|
||||
deleter( from, size ); // nothrow
|
||||
for( size_type i = 0u; i != size; ++i, ++before )
|
||||
before = insert( before, *(from+i) ); // nothrow
|
||||
deleter.release(); // nothrow
|
||||
}
|
||||
else
|
||||
{
|
||||
for( size_type i = 0u; i != size; ++i, ++before )
|
||||
before = insert( before, *(from+i) ); // nothrow
|
||||
}
|
||||
}
|
||||
|
||||
value_type* c_array() // nothrow
|
||||
{
|
||||
if( this->empty() )
|
||||
return 0;
|
||||
this->linearize();
|
||||
T** res = reinterpret_cast<T**>( &this->begin().base()[0] );
|
||||
return res;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <boost/ptr_container/ptr_vector.hpp>
|
||||
#include <boost/ptr_container/ptr_unordered_map.hpp>
|
||||
#include <boost/ptr_container/ptr_unordered_set.hpp>
|
||||
#include <boost/ptr_container/ptr_circular_buffer.hpp>
|
||||
#include <boost/ptr_container/ptr_inserter.hpp>
|
||||
|
||||
#endif
|
||||
|
@ -227,7 +227,7 @@ namespace ptr_container_detail
|
||||
|
||||
template< class Compare, class Allocator >
|
||||
ptr_map_adapter_base( const Compare& comp,
|
||||
const allocator_type& a )
|
||||
const Allocator& a )
|
||||
: base_type( comp, a )
|
||||
{ }
|
||||
|
||||
|
@ -134,33 +134,104 @@ namespace ptr_container_detail
|
||||
CloneAllocator >
|
||||
base_type;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::scoped_deleter scoped_deleter;
|
||||
|
||||
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
|
||||
const_reference;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::auto_type auto_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::clone_allocator_type
|
||||
clone_allocator_type;
|
||||
|
||||
BOOST_PTR_CONTAINER_DEFINE_CONSTRUCTORS( ptr_sequence_adapter,
|
||||
base_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()
|
||||
{ }
|
||||
|
||||
template< class U >
|
||||
explicit ptr_sequence_adapter( const ptr_sequence_adapter<U,VoidPtrSeq>& r )
|
||||
template< class Allocator >
|
||||
explicit ptr_sequence_adapter( const Allocator& a )
|
||||
: base_type( a )
|
||||
{ }
|
||||
|
||||
template< class SizeType >
|
||||
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_container_detail::fixed_length_sequence_tag tag )
|
||||
: base_type( n, a, tag )
|
||||
{ }
|
||||
|
||||
template< class InputIterator >
|
||||
ptr_sequence_adapter( InputIterator first, InputIterator last )
|
||||
: base_type( first, last )
|
||||
{ }
|
||||
|
||||
template< class InputIterator, class Allocator >
|
||||
ptr_sequence_adapter( InputIterator first, InputIterator last,
|
||||
const Allocator& a )
|
||||
: base_type( first, last, a )
|
||||
{ }
|
||||
|
||||
template< class ForwardIterator >
|
||||
ptr_sequence_adapter( ForwardIterator first,
|
||||
ForwardIterator last,
|
||||
ptr_container_detail::fixed_length_sequence_tag tag )
|
||||
: base_type( first, last, tag )
|
||||
{ }
|
||||
|
||||
template< class SizeType, class ForwardIterator >
|
||||
ptr_sequence_adapter( SizeType n,
|
||||
ForwardIterator first,
|
||||
ForwardIterator last,
|
||||
ptr_container_detail::fixed_length_sequence_tag tag )
|
||||
: base_type( n, first, last, tag )
|
||||
{ }
|
||||
|
||||
explicit ptr_sequence_adapter( const ptr_sequence_adapter& r )
|
||||
: base_type( r )
|
||||
{ }
|
||||
|
||||
template< class U >
|
||||
explicit ptr_sequence_adapter( const ptr_sequence_adapter<U,VoidPtrSeq,CloneAllocator>& r )
|
||||
: base_type( r )
|
||||
{ }
|
||||
|
||||
explicit ptr_sequence_adapter( const ptr_sequence_adapter& r,
|
||||
ptr_container_detail::fixed_length_sequence_tag tag )
|
||||
: base_type( r, tag )
|
||||
{ }
|
||||
|
||||
template< class U >
|
||||
explicit ptr_sequence_adapter( const ptr_sequence_adapter<U,VoidPtrSeq,CloneAllocator>& r,
|
||||
ptr_container_detail::fixed_length_sequence_tag tag )
|
||||
: base_type( r, tag )
|
||||
{ }
|
||||
|
||||
template< class PtrContainer >
|
||||
explicit ptr_sequence_adapter( std::auto_ptr<PtrContainer> clone )
|
||||
: base_type( clone )
|
||||
{ }
|
||||
|
||||
ptr_sequence_adapter& operator=( const ptr_sequence_adapter& r )
|
||||
{
|
||||
base_type::operator=( r );
|
||||
return *this;
|
||||
}
|
||||
|
||||
template< class U >
|
||||
ptr_sequence_adapter& operator=( const ptr_sequence_adapter<U,VoidPtrSeq>& r )
|
||||
ptr_sequence_adapter& operator=( const ptr_sequence_adapter<U,VoidPtrSeq,CloneAllocator>& r )
|
||||
{
|
||||
base_type::operator=( r );
|
||||
return *this;
|
||||
|
@ -1,13 +1,19 @@
|
||||
// Copyright Sebastian Ramacher, 2007.
|
||||
// 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)
|
||||
//
|
||||
// Boost.Pointer Container
|
||||
//
|
||||
// Copyright Thorsten Ottosen 2008. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/ptr_container/
|
||||
//
|
||||
|
||||
#ifndef BOOST_PTR_CONTAINER_SERIALIZE_PTR_VECTOR_HPP
|
||||
#define BOOST_PTR_CONTAINER_SERIALIZE_PTR_VECTOR_HPP
|
||||
#ifndef BOOST_PTR_CONTAINER_SERIALIZE_PTR_CIRCULAR_BUFFER_HPP
|
||||
#define BOOST_PTR_CONTAINER_SERIALIZE_PTR_CIRCULAR_BUFFER_HPP
|
||||
|
||||
#include <boost/ptr_container/detail/serialize_reversible_cont.hpp>
|
||||
#include <boost/ptr_container/ptr_vector.hpp>
|
||||
#include <boost/ptr_container/ptr_circular_buffer.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@ -16,9 +22,9 @@ namespace serialization
|
||||
{
|
||||
|
||||
template<class Archive, class T, class CloneAllocator, class Allocator>
|
||||
void load(Archive& ar, ptr_vector<T, CloneAllocator, Allocator>& c, unsigned int version)
|
||||
void load(Archive& ar, ptr_circular_buffer<T, CloneAllocator, Allocator>& c, unsigned int version)
|
||||
{
|
||||
typedef ptr_vector<T, CloneAllocator, Allocator> container_type;
|
||||
typedef ptr_circular_buffer<T, CloneAllocator, Allocator> container_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME container_type::size_type size_type;
|
||||
|
||||
size_type n;
|
||||
@ -29,7 +35,7 @@ void load(Archive& ar, ptr_vector<T, CloneAllocator, Allocator>& c, unsigned int
|
||||
}
|
||||
|
||||
template<class Archive, class T, class CloneAllocator, class Allocator>
|
||||
void serialize(Archive& ar, ptr_vector<T, CloneAllocator, Allocator>& c, const unsigned int version)
|
||||
void serialize(Archive& ar, ptr_circular_buffer<T, CloneAllocator, Allocator>& c, const unsigned int version)
|
||||
{
|
||||
split_free(ar, c, version);
|
||||
}
|
||||
|
@ -14,5 +14,6 @@
|
||||
#include <boost/ptr_container/serialize_ptr_vector.hpp>
|
||||
#include <boost/ptr_container/serialize_ptr_unordered_set.hpp>
|
||||
#include <boost/ptr_container/serialize_ptr_unordered_map.hpp>
|
||||
#include <boost/ptr_container/serialize_ptr_circular_buffer.hpp>
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user