Added boost header
This commit is contained in:
411
test/external/boost/ptr_container/detail/associative_ptr_container.hpp
vendored
Normal file
411
test/external/boost/ptr_container/detail/associative_ptr_container.hpp
vendored
Normal file
@@ -0,0 +1,411 @@
|
||||
//
|
||||
// Boost.Pointer Container
|
||||
//
|
||||
// Copyright Thorsten Ottosen 2003-2005. 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_DETAIL_ASSOCIATIVE_PTR_CONTAINER_HPP
|
||||
#define BOOST_PTR_CONTAINER_DETAIL_ASSOCIATIVE_PTR_CONTAINER_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/ptr_container/detail/reversible_ptr_container.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace ptr_container_detail
|
||||
{
|
||||
template
|
||||
<
|
||||
class Config,
|
||||
class CloneAllocator
|
||||
>
|
||||
class associative_ptr_container :
|
||||
public reversible_ptr_container<Config,CloneAllocator>
|
||||
{
|
||||
typedef reversible_ptr_container<Config,CloneAllocator>
|
||||
base_type;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::scoped_deleter
|
||||
scoped_deleter;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME Config::container_type
|
||||
container_type;
|
||||
public: // typedefs
|
||||
typedef BOOST_DEDUCED_TYPENAME Config::key_type
|
||||
key_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME Config::key_compare
|
||||
key_compare;
|
||||
typedef BOOST_DEDUCED_TYPENAME Config::value_compare
|
||||
value_compare;
|
||||
typedef BOOST_DEDUCED_TYPENAME Config::hasher
|
||||
hasher;
|
||||
typedef BOOST_DEDUCED_TYPENAME Config::key_equal
|
||||
key_equal;
|
||||
typedef BOOST_DEDUCED_TYPENAME Config::iterator
|
||||
iterator;
|
||||
typedef BOOST_DEDUCED_TYPENAME Config::const_iterator
|
||||
const_iterator;
|
||||
typedef BOOST_DEDUCED_TYPENAME Config::local_iterator
|
||||
local_iterator;
|
||||
typedef BOOST_DEDUCED_TYPENAME Config::const_local_iterator
|
||||
const_local_iterator;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::size_type
|
||||
size_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::reference
|
||||
reference;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::const_reference
|
||||
const_reference;
|
||||
|
||||
public: // foundation
|
||||
associative_ptr_container()
|
||||
{ }
|
||||
|
||||
template< class SizeType >
|
||||
associative_ptr_container( SizeType n, unordered_associative_container_tag tag )
|
||||
: base_type( n, tag )
|
||||
{ }
|
||||
|
||||
template< class Compare, class Allocator >
|
||||
associative_ptr_container( const Compare& comp,
|
||||
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,
|
||||
const Allocator& a )
|
||||
: base_type( hash, pred, a )
|
||||
{ }
|
||||
|
||||
template< class InputIterator, class Compare, class Allocator >
|
||||
associative_ptr_container( InputIterator first, InputIterator last,
|
||||
const Compare& comp,
|
||||
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,
|
||||
const Pred& pred,
|
||||
const Allocator& a )
|
||||
: base_type( first, last, hash, pred, a )
|
||||
{ }
|
||||
|
||||
template< class PtrContainer >
|
||||
explicit associative_ptr_container( std::auto_ptr<PtrContainer> r )
|
||||
: base_type( r )
|
||||
{ }
|
||||
|
||||
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() )
|
||||
{ }
|
||||
|
||||
template< class PtrContainer >
|
||||
associative_ptr_container& operator=( std::auto_ptr<PtrContainer> r ) // nothrow
|
||||
{
|
||||
base_type::operator=( r );
|
||||
return *this;
|
||||
}
|
||||
|
||||
associative_ptr_container& operator=( associative_ptr_container r ) // strong
|
||||
{
|
||||
this->swap( r );
|
||||
return *this;
|
||||
}
|
||||
|
||||
public: // associative container interface
|
||||
key_compare key_comp() const
|
||||
{
|
||||
return this->base().key_comp();
|
||||
}
|
||||
|
||||
value_compare value_comp() const
|
||||
{
|
||||
return this->base().value_comp();
|
||||
}
|
||||
|
||||
iterator erase( iterator before ) // nothrow
|
||||
{
|
||||
BOOST_ASSERT( !this->empty() );
|
||||
BOOST_ASSERT( before != this->end() );
|
||||
|
||||
this->remove( before ); // nothrow
|
||||
iterator res( before ); // nothrow
|
||||
++res; // nothrow
|
||||
this->base().erase( before.base() ); // nothrow
|
||||
return res; // nothrow
|
||||
}
|
||||
|
||||
size_type erase( const key_type& x ) // nothrow
|
||||
{
|
||||
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
|
||||
}
|
||||
|
||||
iterator erase( iterator first,
|
||||
iterator last ) // nothrow
|
||||
{
|
||||
iterator res( last ); // nothrow
|
||||
if( res != this->end() )
|
||||
++res; // nothrow
|
||||
|
||||
this->remove( first, last ); // nothrow
|
||||
this->base().erase( first.base(), last.base() ); // nothrow
|
||||
return res; // nothrow
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
#else
|
||||
template< class Range >
|
||||
BOOST_DEDUCED_TYPENAME boost::disable_if< boost::is_convertible<Range&,key_type&>,
|
||||
iterator >::type
|
||||
erase( const Range& r )
|
||||
{
|
||||
return erase( boost::begin(r), boost::end(r) );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
template< class AssociatePtrCont >
|
||||
void multi_transfer( BOOST_DEDUCED_TYPENAME AssociatePtrCont::iterator object,
|
||||
AssociatePtrCont& from ) // strong
|
||||
{
|
||||
BOOST_ASSERT( (void*)&from != (void*)this );
|
||||
BOOST_ASSERT( !from.empty() && "Cannot transfer from empty container" );
|
||||
|
||||
this->base().insert( *object.base() ); // strong
|
||||
from.base().erase( object.base() ); // nothrow
|
||||
}
|
||||
|
||||
template< class AssociatePtrCont >
|
||||
size_type multi_transfer( BOOST_DEDUCED_TYPENAME AssociatePtrCont::iterator first,
|
||||
BOOST_DEDUCED_TYPENAME AssociatePtrCont::iterator last,
|
||||
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
|
||||
to_delete( first );
|
||||
++first;
|
||||
from.base().erase( to_delete.base() ); // nothrow
|
||||
++res;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
template< class AssociatePtrCont >
|
||||
bool single_transfer( BOOST_DEDUCED_TYPENAME AssociatePtrCont::iterator object,
|
||||
AssociatePtrCont& from ) // strong
|
||||
{
|
||||
BOOST_ASSERT( (void*)&from != (void*)this );
|
||||
BOOST_ASSERT( !from.empty() && "Cannot transfer from empty container" );
|
||||
|
||||
std::pair<BOOST_DEDUCED_TYPENAME base_type::ptr_iterator,bool> p =
|
||||
this->base().insert( *object.base() ); // strong
|
||||
if( p.second )
|
||||
from.base().erase( object.base() ); // nothrow
|
||||
|
||||
return p.second;
|
||||
}
|
||||
|
||||
template< class AssociatePtrCont >
|
||||
size_type single_transfer( BOOST_DEDUCED_TYPENAME AssociatePtrCont::iterator first,
|
||||
BOOST_DEDUCED_TYPENAME AssociatePtrCont::iterator last,
|
||||
AssociatePtrCont& from ) // basic
|
||||
{
|
||||
BOOST_ASSERT( (void*)&from != (void*)this );
|
||||
|
||||
size_type res = 0;
|
||||
for( ; first != last; )
|
||||
{
|
||||
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
|
||||
to_delete( first );
|
||||
++first;
|
||||
if( p.second )
|
||||
{
|
||||
from.base().erase( to_delete.base() ); // nothrow
|
||||
++res;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
reference front()
|
||||
{
|
||||
BOOST_ASSERT( !this->empty() );
|
||||
BOOST_ASSERT( *this->begin().base() != 0 );
|
||||
return *this->begin();
|
||||
}
|
||||
|
||||
const_reference front() const
|
||||
{
|
||||
return const_cast<associative_ptr_container*>(this)->front();
|
||||
}
|
||||
|
||||
reference back()
|
||||
{
|
||||
BOOST_ASSERT( !this->empty() );
|
||||
BOOST_ASSERT( *(--this->end()).base() != 0 );
|
||||
return *--this->end();
|
||||
}
|
||||
|
||||
const_reference back() const
|
||||
{
|
||||
return const_cast<associative_ptr_container*>(this)->back();
|
||||
}
|
||||
|
||||
protected: // unordered interface
|
||||
hasher hash_function() const
|
||||
{
|
||||
return this->base().hash_function();
|
||||
}
|
||||
|
||||
key_equal key_eq() const
|
||||
{
|
||||
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 );
|
||||
}
|
||||
|
||||
public:
|
||||
#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 )
|
||||
{
|
||||
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'
|
||||
|
||||
|
||||
#endif
|
||||
69
test/external/boost/ptr_container/detail/default_deleter.hpp
vendored
Normal file
69
test/external/boost/ptr_container/detail/default_deleter.hpp
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
// (C) Copyright Jonathan Turkanis 2004-2005.
|
||||
// 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.)
|
||||
|
||||
// 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
|
||||
// type by default.
|
||||
|
||||
#ifndef 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>
|
||||
#include <boost/type_traits/is_array.hpp>
|
||||
#include <boost/type_traits/remove_bounds.hpp>
|
||||
|
||||
namespace boost { namespace ptr_container_detail { namespace move_ptrs {
|
||||
|
||||
namespace ptr_container_detail {
|
||||
|
||||
template<typename T>
|
||||
struct deleter_base {
|
||||
typedef void (*deleter)(T*);
|
||||
deleter_base(deleter d) { delete_ = d; }
|
||||
void operator() (T* t) const { delete_(t); }
|
||||
static deleter delete_;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
typename deleter_base<T>::deleter
|
||||
deleter_base<T>::delete_;
|
||||
|
||||
template<typename T>
|
||||
struct scalar_deleter : deleter_base<T> {
|
||||
typedef deleter_base<T> base;
|
||||
scalar_deleter() : base(do_delete) { }
|
||||
static void do_delete(T* t) { checked_delete(t); }
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct array_deleter
|
||||
: deleter_base<typename remove_bounds<T>::type>
|
||||
{
|
||||
typedef typename remove_bounds<T>::type element_type;
|
||||
typedef deleter_base<element_type> base;
|
||||
array_deleter() : base(do_delete) { }
|
||||
static void do_delete(element_type* t) { checked_array_delete(t); }
|
||||
};
|
||||
|
||||
} // End namespace ptr_container_detail.
|
||||
|
||||
template<typename T>
|
||||
struct default_deleter
|
||||
: mpl::if_<
|
||||
is_array<T>,
|
||||
ptr_container_detail::array_deleter<T>,
|
||||
ptr_container_detail::scalar_deleter<T>
|
||||
>::type
|
||||
{
|
||||
default_deleter() { }
|
||||
template<typename TT>
|
||||
default_deleter(default_deleter<TT> tt) { }
|
||||
};
|
||||
|
||||
} } } // End namespaces ptr_container_detail, move_ptrs, boost.
|
||||
|
||||
#endif // #ifndef BOOST_MOVE_PTR_DEFAULT_DELETER_HPP_INCLUDED
|
||||
73
test/external/boost/ptr_container/detail/is_convertible.hpp
vendored
Normal file
73
test/external/boost/ptr_container/detail/is_convertible.hpp
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
// (C) Copyright Thorsten Ottosen 2005
|
||||
// (C) Copyright Howard Hinnant 2004
|
||||
// (C) Copyright Jonathan Turkanis 2004
|
||||
// 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.)
|
||||
|
||||
//
|
||||
// Contains type traits machinery for incomplete arrays. MPL compatibility
|
||||
// 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
|
||||
|
||||
#include <boost/config.hpp> // BOOST_STATIC_CONSTANT.
|
||||
#include <boost/mpl/aux_/lambda_support.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/is_array.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/remove_bounds.hpp>
|
||||
#include <boost/type_traits/remove_cv.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
|
||||
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
|
||||
mpl::and_<
|
||||
is_array<T>,
|
||||
is_array<U>,
|
||||
is_same<t_base, u_base>,
|
||||
is_convertible<t_element*, u_element*>
|
||||
>::type type;
|
||||
BOOST_STATIC_CONSTANT(bool, value = type::value);
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(2, is_array_convertible, (T, U))
|
||||
};
|
||||
|
||||
template<typename T, typename U>
|
||||
struct is_smart_ptr_convertible
|
||||
: mpl::if_<
|
||||
is_array<T>,
|
||||
is_array_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<
|
||||
is_smart_ptr_convertible<Src, Tgt>,
|
||||
T
|
||||
>
|
||||
{ };
|
||||
#else
|
||||
template<typename Src, typename Tgt, class T >
|
||||
struct enable_if_convertible : mpl::identity<T> { };
|
||||
#endif
|
||||
|
||||
} } } // End namespaces ptr_container_detail, move_ptrs, boost.
|
||||
|
||||
#endif // #ifndef BOOST_MOVE_PTR_ARRAYS_HPP_INCLUDED
|
||||
132
test/external/boost/ptr_container/detail/map_iterator.hpp
vendored
Normal file
132
test/external/boost/ptr_container/detail/map_iterator.hpp
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
//
|
||||
// Boost.Pointer Container
|
||||
//
|
||||
// Copyright Thorsten Ottosen 2003-2005. 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_MAP_ITERATOR_HPP
|
||||
#define BOOST_PTR_CONTAINER_MAP_ITERATOR_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
#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
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace ptr_container_detail
|
||||
{
|
||||
template< class F, class S >
|
||||
struct ref_pair
|
||||
{
|
||||
typedef F first_type;
|
||||
typedef S second_type;
|
||||
|
||||
const F& first;
|
||||
S second;
|
||||
|
||||
template< class F2, class S2 >
|
||||
ref_pair( const std::pair<F2,S2>& p )
|
||||
: first(p.first), second(static_cast<S>(p.second))
|
||||
{ }
|
||||
|
||||
template< class RP >
|
||||
ref_pair( const RP* rp )
|
||||
: first(rp->first), second(rp->second)
|
||||
{ }
|
||||
|
||||
const ref_pair* const operator->() const
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
friend inline bool operator==( ref_pair l, ref_pair r )
|
||||
{
|
||||
return l.first == r.first &&
|
||||
boost::equal_pointees( l.second, r.second );
|
||||
}
|
||||
|
||||
friend inline bool operator!=( ref_pair l, ref_pair r )
|
||||
{
|
||||
return !( l == r );
|
||||
}
|
||||
|
||||
friend inline bool operator<( ref_pair l, ref_pair r )
|
||||
{
|
||||
if( l.first == r.first )
|
||||
return boost::less_pointees( l.second, r.second );
|
||||
else
|
||||
return l.first < r.first;
|
||||
}
|
||||
|
||||
friend inline bool operator>( ref_pair l, ref_pair r )
|
||||
{
|
||||
return r < l;
|
||||
}
|
||||
|
||||
friend inline bool operator<=( ref_pair l, ref_pair r )
|
||||
{
|
||||
return !(r < l);
|
||||
}
|
||||
|
||||
friend inline bool operator>=( ref_pair l, ref_pair r )
|
||||
{
|
||||
return !(l < r);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
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,
|
||||
ptr_container_detail::ref_pair<F,S> >
|
||||
{
|
||||
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> >
|
||||
base_type;
|
||||
|
||||
|
||||
public:
|
||||
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 )
|
||||
: base_type(r.base())
|
||||
{ }
|
||||
|
||||
}; // class 'ptr_map_iterator'
|
||||
|
||||
}
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
66
test/external/boost/ptr_container/detail/meta_functions.hpp
vendored
Normal file
66
test/external/boost/ptr_container/detail/meta_functions.hpp
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// 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_DETAIL_META_FUNCTIONS
|
||||
#define BOOST_PTR_CONTAINER_DETAIL_META_FUNCTIONS
|
||||
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace ptr_container_detail
|
||||
{
|
||||
template< class T >
|
||||
struct select_value_compare
|
||||
{
|
||||
typedef typename T::value_compare type;
|
||||
};
|
||||
|
||||
template< class T >
|
||||
struct select_key_compare
|
||||
{
|
||||
typedef typename T::key_compare type;
|
||||
};
|
||||
|
||||
template< class T >
|
||||
struct select_hasher
|
||||
{
|
||||
typedef typename T::hasher type;
|
||||
};
|
||||
|
||||
template< class T >
|
||||
struct select_key_equal
|
||||
{
|
||||
typedef typename T::key_equal type;
|
||||
};
|
||||
|
||||
template< class T >
|
||||
struct select_iterator
|
||||
{
|
||||
typedef typename T::iterator type;
|
||||
};
|
||||
|
||||
template< class T >
|
||||
struct select_local_iterator
|
||||
{
|
||||
typedef typename T::local_iterator type;
|
||||
};
|
||||
|
||||
template< class T >
|
||||
struct select_const_local_iterator
|
||||
{
|
||||
typedef typename T::const_local_iterator type;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
44
test/external/boost/ptr_container/detail/move.hpp
vendored
Normal file
44
test/external/boost/ptr_container/detail/move.hpp
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
// (C) Copyright Daniel Wallin 2004.
|
||||
// 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.)
|
||||
|
||||
// Contains the definitions of the class template move_source and the function
|
||||
// template move, which together make move pointers moveable.
|
||||
|
||||
#ifndef BOOST_MOVE_HPP_INCLUDED
|
||||
#define BOOST_MOVE_HPP_INCLUDED
|
||||
|
||||
namespace boost { namespace ptr_container_detail {
|
||||
|
||||
namespace move_ptrs {
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4512)
|
||||
#endif
|
||||
|
||||
template<typename Ptr>
|
||||
class move_source {
|
||||
public:
|
||||
move_source(Ptr& ptr) : ptr_(ptr) {}
|
||||
Ptr& ptr() const { return ptr_; }
|
||||
private:
|
||||
Ptr& ptr_;
|
||||
move_source(const Ptr&);
|
||||
};
|
||||
|
||||
#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)
|
||||
{ return move_ptrs::move_source<T>(x); }
|
||||
|
||||
} // namespace 'ptr_container_detail'
|
||||
} // End namespace boost.
|
||||
|
||||
#endif // #ifndef BOOST_MOVE_HPP_INCLUDED
|
||||
752
test/external/boost/ptr_container/detail/reversible_ptr_container.hpp
vendored
Normal file
752
test/external/boost/ptr_container/detail/reversible_ptr_container.hpp
vendored
Normal file
@@ -0,0 +1,752 @@
|
||||
//
|
||||
// Boost.Pointer Container
|
||||
//
|
||||
// Copyright Thorsten Ottosen 2003-2005. 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_DETAIL_REVERSIBLE_PTR_CONTAINER_HPP
|
||||
#define BOOST_PTR_CONTAINER_DETAIL_REVERSIBLE_PTR_CONTAINER_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/ptr_container/detail/throw_exception.hpp>
|
||||
#include <boost/ptr_container/detail/scoped_deleter.hpp>
|
||||
#include <boost/ptr_container/detail/static_move_ptr.hpp>
|
||||
#include <boost/ptr_container/exception.hpp>
|
||||
#include <boost/ptr_container/clone_allocator.hpp>
|
||||
#include <boost/ptr_container/nullable.hpp>
|
||||
|
||||
#ifdef BOOST_NO_SFINAE
|
||||
#else
|
||||
#include <boost/range/functions.hpp>
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/iterator/reverse_iterator.hpp>
|
||||
#include <boost/range/iterator.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/type_traits/is_pointer.hpp>
|
||||
#include <boost/type_traits/is_integral.hpp>
|
||||
#include <typeinfo>
|
||||
#include <memory>
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4127)
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace ptr_container_detail
|
||||
{
|
||||
template< class CloneAllocator >
|
||||
struct clone_deleter
|
||||
{
|
||||
template< class T >
|
||||
void operator()( const T* p ) const
|
||||
{
|
||||
CloneAllocator::deallocate_clone( p );
|
||||
}
|
||||
};
|
||||
|
||||
template< class T >
|
||||
struct is_pointer_or_integral
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = is_pointer<T>::value || is_integral<T>::value );
|
||||
};
|
||||
|
||||
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 {};
|
||||
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
class Config,
|
||||
class CloneAllocator
|
||||
>
|
||||
class reversible_ptr_container
|
||||
{
|
||||
private:
|
||||
BOOST_STATIC_CONSTANT( bool, allow_null = Config::allow_null );
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME Config::value_type Ty_;
|
||||
|
||||
template< bool allow_null_values >
|
||||
struct null_clone_allocator
|
||||
{
|
||||
template< class Iter >
|
||||
static Ty_* allocate_clone_from_iterator( Iter i )
|
||||
{
|
||||
return allocate_clone( Config::get_const_pointer( i ) );
|
||||
}
|
||||
|
||||
static Ty_* allocate_clone( const Ty_* x )
|
||||
{
|
||||
if( allow_null_values )
|
||||
{
|
||||
if( x == 0 )
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_ASSERT( x != 0 && "Cannot insert clone of null!" );
|
||||
}
|
||||
|
||||
Ty_* res = CloneAllocator::allocate_clone( *x );
|
||||
BOOST_ASSERT( typeid(*res) == typeid(*x) &&
|
||||
"CloneAllocator::allocate_clone() does not clone the "
|
||||
"object properly. Check that new_clone() is implemented"
|
||||
" correctly" );
|
||||
return res;
|
||||
}
|
||||
|
||||
static void deallocate_clone( const Ty_* x )
|
||||
{
|
||||
if( allow_null_values )
|
||||
{
|
||||
if( x == 0 )
|
||||
return;
|
||||
}
|
||||
|
||||
CloneAllocator::deallocate_clone( x );
|
||||
}
|
||||
};
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME Config::void_container_type Cont;
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
typedef null_clone_allocator<reversible_ptr_container::allow_null>
|
||||
null_cloner_type;
|
||||
#else
|
||||
typedef null_clone_allocator<allow_null> null_cloner_type;
|
||||
#endif
|
||||
typedef clone_deleter<null_cloner_type> Deleter;
|
||||
|
||||
Cont c_;
|
||||
|
||||
public:
|
||||
Cont& base() { return c_; }
|
||||
protected: // having this public could break encapsulation
|
||||
const Cont& base() const { return c_; }
|
||||
|
||||
public: // typedefs
|
||||
typedef Ty_* value_type;
|
||||
typedef Ty_* pointer;
|
||||
typedef Ty_& reference;
|
||||
typedef const Ty_& const_reference;
|
||||
|
||||
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 >
|
||||
const_reverse_iterator;
|
||||
typedef BOOST_DEDUCED_TYPENAME Cont::difference_type
|
||||
difference_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME Cont::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_,Deleter>
|
||||
auto_type;
|
||||
|
||||
protected:
|
||||
|
||||
typedef ptr_container_detail::scoped_deleter<Ty_,null_cloner_type>
|
||||
scoped_deleter;
|
||||
typedef BOOST_DEDUCED_TYPENAME Cont::iterator
|
||||
ptr_iterator;
|
||||
typedef BOOST_DEDUCED_TYPENAME Cont::const_iterator
|
||||
ptr_const_iterator;
|
||||
private:
|
||||
|
||||
template< class InputIterator >
|
||||
void copy( InputIterator first, InputIterator last )
|
||||
{
|
||||
std::copy( first, last, begin() );
|
||||
}
|
||||
|
||||
void copy( const reversible_ptr_container& r )
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
template< class ForwardIterator >
|
||||
void clone_assign( ForwardIterator first,
|
||||
ForwardIterator last ) // strong
|
||||
{
|
||||
BOOST_ASSERT( first != last );
|
||||
scoped_deleter sd( first, last ); // strong
|
||||
copy_clones_and_release( sd ); // nothrow
|
||||
}
|
||||
|
||||
template< class ForwardIterator >
|
||||
void clone_back_insert( ForwardIterator first,
|
||||
ForwardIterator last )
|
||||
{
|
||||
BOOST_ASSERT( first != last );
|
||||
scoped_deleter sd( first, last );
|
||||
insert_clones_and_release( sd, end() );
|
||||
}
|
||||
|
||||
void remove_all()
|
||||
{
|
||||
remove( begin(), end() );
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
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() );
|
||||
sd.release();
|
||||
}
|
||||
|
||||
void insert_clones_and_release( scoped_deleter& sd ) // strong
|
||||
{
|
||||
c_.insert( sd.begin(), sd.end() );
|
||||
sd.release();
|
||||
}
|
||||
|
||||
template< class U >
|
||||
void remove( U* ptr )
|
||||
{
|
||||
null_policy_deallocate_clone( ptr );
|
||||
}
|
||||
|
||||
template< class I >
|
||||
void remove( I i )
|
||||
{
|
||||
null_policy_deallocate_clone( Config::get_const_pointer(i) );
|
||||
}
|
||||
|
||||
template< class I >
|
||||
void remove( I first, I last )
|
||||
{
|
||||
for( ; first != last; ++first )
|
||||
remove( first );
|
||||
}
|
||||
|
||||
static void enforce_null_policy( const Ty_* x, const char* msg )
|
||||
{
|
||||
if( !allow_null )
|
||||
{
|
||||
BOOST_PTR_CONTAINER_THROW_EXCEPTION( 0 == x && "null not allowed",
|
||||
bad_pointer, msg );
|
||||
}
|
||||
}
|
||||
|
||||
static Ty_* null_policy_allocate_clone( const Ty_* x )
|
||||
{
|
||||
return null_cloner_type::allocate_clone( x );
|
||||
}
|
||||
|
||||
static void null_policy_deallocate_clone( const Ty_* x )
|
||||
{
|
||||
null_cloner_type::deallocate_clone( x );
|
||||
}
|
||||
|
||||
private:
|
||||
template< class ForwardIterator >
|
||||
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
|
||||
{
|
||||
while( first != last )
|
||||
{
|
||||
insert( end(), null_cloner_type::allocate_clone_from_iterator(first) );
|
||||
++first;
|
||||
}
|
||||
}
|
||||
|
||||
template< class I >
|
||||
void constructor_impl( I first, I last, std::forward_iterator_tag ) // strong
|
||||
{
|
||||
if( first == last )
|
||||
return;
|
||||
clone_back_insert( first, last );
|
||||
}
|
||||
|
||||
template< class I >
|
||||
void associative_constructor_impl( I first, I last ) // strong
|
||||
{
|
||||
if( first == last )
|
||||
return;
|
||||
|
||||
scoped_deleter sd( first, last );
|
||||
insert_clones_and_release( sd );
|
||||
}
|
||||
|
||||
public: // foundation! should be protected!
|
||||
reversible_ptr_container()
|
||||
{ }
|
||||
|
||||
template< class SizeType >
|
||||
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 )
|
||||
{
|
||||
swap( *clone );
|
||||
}
|
||||
|
||||
reversible_ptr_container( const reversible_ptr_container& r )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
constructor_impl( r.begin(), r.end(), std::forward_iterator_tag() );
|
||||
}
|
||||
|
||||
template< class PtrContainer >
|
||||
reversible_ptr_container& operator=( std::auto_ptr<PtrContainer> clone ) // nothrow
|
||||
{
|
||||
swap( *clone );
|
||||
return *this;
|
||||
}
|
||||
|
||||
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,
|
||||
InputIterator last,
|
||||
const allocator_type& a = allocator_type() ) // basic, strong
|
||||
: c_( a )
|
||||
{
|
||||
constructor_impl( first, last,
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
#else
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
#endif
|
||||
iterator_category<InputIterator>::type() );
|
||||
}
|
||||
|
||||
template< class Compare >
|
||||
reversible_ptr_container( const Compare& comp,
|
||||
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 Compare >
|
||||
reversible_ptr_container( const Compare& comp,
|
||||
const allocator_type& a,
|
||||
associative_container_tag )
|
||||
: c_( comp, a )
|
||||
{ }
|
||||
|
||||
template< class InputIterator >
|
||||
reversible_ptr_container( InputIterator first,
|
||||
InputIterator last,
|
||||
associative_container_tag )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
associative_constructor_impl( first, last );
|
||||
}
|
||||
|
||||
explicit reversible_ptr_container( size_type n )
|
||||
: c_( n ) {}
|
||||
|
||||
template< class Hash, class Pred >
|
||||
reversible_ptr_container( const Hash& h,
|
||||
const Pred& pred,
|
||||
const allocator_type& a )
|
||||
: c_( h, pred, a ) {}
|
||||
|
||||
template< class InputIterator, class Hash, class Pred >
|
||||
reversible_ptr_container( InputIterator first,
|
||||
InputIterator last,
|
||||
const Hash& h,
|
||||
const Pred& pred,
|
||||
const allocator_type& a )
|
||||
: c_( h, pred, a )
|
||||
{
|
||||
associative_constructor_impl( first, last );
|
||||
}
|
||||
|
||||
public:
|
||||
~reversible_ptr_container()
|
||||
{
|
||||
remove_all();
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
allocator_type get_allocator() const
|
||||
{
|
||||
return c_.get_allocator();
|
||||
}
|
||||
|
||||
public: // container requirements
|
||||
iterator begin()
|
||||
{ return iterator( c_.begin() ); }
|
||||
const_iterator begin() const
|
||||
{ return const_iterator( c_.begin() ); }
|
||||
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
|
||||
{ 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
|
||||
{
|
||||
c_.swap( r.c_ );
|
||||
}
|
||||
|
||||
size_type size() const // nothrow
|
||||
{
|
||||
return c_.size();
|
||||
}
|
||||
|
||||
size_type max_size() const // nothrow
|
||||
{
|
||||
return c_.max_size();
|
||||
}
|
||||
|
||||
bool empty() const // nothrow
|
||||
{
|
||||
return c_.empty();
|
||||
}
|
||||
|
||||
public: // optional container requirements
|
||||
|
||||
bool operator==( const reversible_ptr_container& r ) const // nothrow
|
||||
{
|
||||
if( size() != r.size() )
|
||||
return false;
|
||||
else
|
||||
return std::equal( begin(), end(), r.begin() );
|
||||
}
|
||||
|
||||
bool operator!=( const reversible_ptr_container& r ) const // nothrow
|
||||
{
|
||||
return !(*this == r);
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
return !(r < *this);
|
||||
}
|
||||
|
||||
bool operator>( const reversible_ptr_container& r ) const // nothrow
|
||||
{
|
||||
return r < *this;
|
||||
}
|
||||
|
||||
bool operator>=( const reversible_ptr_container& r ) const // nothrow
|
||||
{
|
||||
return !(*this < r);
|
||||
}
|
||||
|
||||
public: // modifiers
|
||||
|
||||
iterator insert( iterator before, Ty_* x )
|
||||
{
|
||||
enforce_null_policy( x, "Null pointer in 'insert()'" );
|
||||
|
||||
auto_type ptr( x ); // nothrow
|
||||
iterator res( c_.insert( before.base(), x ) ); // strong, commit
|
||||
ptr.release(); // nothrow
|
||||
return res;
|
||||
}
|
||||
|
||||
template< class U >
|
||||
iterator insert( iterator before, std::auto_ptr<U> x )
|
||||
{
|
||||
return insert( before, x.release() );
|
||||
}
|
||||
|
||||
iterator erase( iterator x ) // nothrow
|
||||
{
|
||||
BOOST_ASSERT( !empty() );
|
||||
BOOST_ASSERT( x != end() );
|
||||
|
||||
remove( x );
|
||||
return iterator( c_.erase( x.base() ) );
|
||||
}
|
||||
|
||||
iterator erase( iterator first, iterator last ) // nothrow
|
||||
{
|
||||
remove( first, last );
|
||||
return iterator( c_.erase( first.base(),
|
||||
last.base() ) );
|
||||
}
|
||||
|
||||
template< class Range >
|
||||
iterator erase( const Range& r )
|
||||
{
|
||||
return erase( boost::begin(r), boost::end(r) );
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
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" );
|
||||
|
||||
auto_type ptr( Config::get_pointer( where ) ); // nothrow
|
||||
c_.erase( where.base() ); // nothrow
|
||||
return boost::ptr_container_detail::move( ptr );
|
||||
}
|
||||
|
||||
auto_type replace( iterator where, Ty_* x ) // strong
|
||||
{
|
||||
BOOST_ASSERT( where != end() );
|
||||
|
||||
enforce_null_policy( x, "Null pointer in 'replace()'" );
|
||||
|
||||
auto_type ptr( x );
|
||||
|
||||
BOOST_PTR_CONTAINER_THROW_EXCEPTION( empty(), bad_ptr_container_operation,
|
||||
"'replace()' on empty container" );
|
||||
|
||||
auto_type old( Config::get_pointer( where ) ); // nothrow
|
||||
const_cast<void*&>(*where.base()) = ptr.release();
|
||||
return boost::ptr_container_detail::move( old );
|
||||
}
|
||||
|
||||
template< class U >
|
||||
auto_type replace( iterator where, std::auto_ptr<U> x )
|
||||
{
|
||||
return replace( where, x.release() );
|
||||
}
|
||||
|
||||
auto_type replace( size_type idx, Ty_* x ) // strong
|
||||
{
|
||||
enforce_null_policy( x, "Null pointer in 'replace()'" );
|
||||
|
||||
auto_type ptr( x );
|
||||
|
||||
BOOST_PTR_CONTAINER_THROW_EXCEPTION( idx >= size(), bad_index,
|
||||
"'replace()' out of bounds" );
|
||||
|
||||
auto_type old( static_cast<Ty_*>( c_[idx] ) ); // nothrow
|
||||
c_[idx] = ptr.release(); // nothrow, commit
|
||||
return boost::ptr_container_detail::move( old );
|
||||
}
|
||||
|
||||
template< class U >
|
||||
auto_type replace( size_type idx, std::auto_ptr<U> x )
|
||||
{
|
||||
return replace( idx, x.release() );
|
||||
}
|
||||
|
||||
}; // 'reversible_ptr_container'
|
||||
|
||||
|
||||
#if BOOST_WORKAROUND(__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;
|
||||
#endif
|
||||
|
||||
//
|
||||
// two-phase lookup of template functions
|
||||
// is buggy on most compilers, so we use a macro instead
|
||||
//
|
||||
#define BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( PC, base_type, this_type ) \
|
||||
explicit PC( std::auto_ptr<this_type> r ) \
|
||||
: base_type ( r ) { } \
|
||||
\
|
||||
PC& operator=( std::auto_ptr<this_type> r ) \
|
||||
{ \
|
||||
base_type::operator=( r ); \
|
||||
return *this; \
|
||||
} \
|
||||
\
|
||||
std::auto_ptr<this_type> release() \
|
||||
{ \
|
||||
std::auto_ptr<this_type> ptr( new this_type );\
|
||||
this->swap( *ptr ); \
|
||||
return ptr; \
|
||||
} \
|
||||
BOOST_PTR_CONTAINER_DEFINE_RELEASE( base_type ) \
|
||||
\
|
||||
std::auto_ptr<this_type> clone() const \
|
||||
{ \
|
||||
return std::auto_ptr<this_type>( new this_type( this->begin(), this->end() ) ); \
|
||||
}
|
||||
|
||||
#define BOOST_PTR_CONTAINER_DEFINE_COPY_CONSTRUCTORS( PC, base_type ) \
|
||||
\
|
||||
template< class U > \
|
||||
PC( const PC<U>& r ) : base_type( r ) { } \
|
||||
\
|
||||
PC& operator=( PC r ) \
|
||||
{ \
|
||||
this->swap( r ); \
|
||||
return *this; \
|
||||
} \
|
||||
|
||||
|
||||
#define BOOST_PTR_CONTAINER_DEFINE_CONSTRUCTORS( PC, 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::const_reference const_reference; \
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::allocator_type allocator_type; \
|
||||
PC() {} \
|
||||
explicit PC( const allocator_type& a ) : base_type(a) {} \
|
||||
template< class InputIterator > \
|
||||
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 ) {}
|
||||
|
||||
#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 )
|
||||
|
||||
#define BOOST_PTR_CONTAINER_DEFINE_SEQEUENCE_MEMBERS( PC, base_type, this_type ) \
|
||||
BOOST_PTR_CONTAINER_DEFINE_NON_INHERITED_MEMBERS( PC, base_type, this_type ) \
|
||||
BOOST_PTR_CONTAINER_DEFINE_COPY_CONSTRUCTORS( PC, base_type )
|
||||
|
||||
} // namespace 'ptr_container_detail'
|
||||
|
||||
//
|
||||
// @remark: expose movability of internal move-pointer
|
||||
//
|
||||
namespace ptr_container
|
||||
{
|
||||
using ptr_container_detail::move;
|
||||
}
|
||||
|
||||
} // namespace 'boost'
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
121
test/external/boost/ptr_container/detail/scoped_deleter.hpp
vendored
Normal file
121
test/external/boost/ptr_container/detail/scoped_deleter.hpp
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
//
|
||||
// Boost.Pointer Container
|
||||
//
|
||||
// Copyright Thorsten Ottosen 2003-2005. 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_SCOPED_DELETER_HPP
|
||||
#define BOOST_PTR_CONTAINER_SCOPED_DELETER_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <iterator>
|
||||
#include <cstddef>
|
||||
#include <boost/scoped_array.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace ptr_container_detail
|
||||
{
|
||||
template< class T, class CloneAllocator >
|
||||
class scoped_deleter
|
||||
{
|
||||
typedef std::size_t size_type;
|
||||
scoped_array<T*> ptrs_;
|
||||
size_type stored_;
|
||||
bool released_;
|
||||
|
||||
public:
|
||||
scoped_deleter( T** a, size_type size )
|
||||
: ptrs_( a ), stored_( size ), released_( false )
|
||||
{
|
||||
BOOST_ASSERT( a );
|
||||
}
|
||||
|
||||
scoped_deleter( size_type size )
|
||||
: ptrs_( new T*[size] ), stored_( 0 ),
|
||||
released_( false )
|
||||
{
|
||||
BOOST_ASSERT( size > 0 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
scoped_deleter( size_type n, const T& x ) // strong
|
||||
: ptrs_( new T*[n] ), stored_(0),
|
||||
released_( false )
|
||||
{
|
||||
for( size_type i = 0; i != n; i++ )
|
||||
add( CloneAllocator::allocate_clone( &x ) );
|
||||
BOOST_ASSERT( stored_ > 0 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
template< class InputIterator >
|
||||
scoped_deleter ( InputIterator first, InputIterator last ) // strong
|
||||
: ptrs_( new T*[ std::distance(first,last) ] ),
|
||||
stored_(0),
|
||||
released_( false )
|
||||
{
|
||||
for( ; first != last; ++first )
|
||||
add( CloneAllocator::allocate_clone_from_iterator( first ) );
|
||||
BOOST_ASSERT( stored_ > 0 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
~scoped_deleter()
|
||||
{
|
||||
if ( !released_ )
|
||||
{
|
||||
for( size_type i = 0u; i != stored_; ++i )
|
||||
CloneAllocator::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'
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
87
test/external/boost/ptr_container/detail/serialize_ptr_map_adapter.hpp
vendored
Normal file
87
test/external/boost/ptr_container/detail/serialize_ptr_map_adapter.hpp
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
// 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)
|
||||
|
||||
#ifndef BOOST_PTR_CONTAINER_DETAIL_SERIALIZE_PTR_MAP_ADAPTER_HPP
|
||||
#define BOOST_PTR_CONTAINER_DETAIL_SERIALIZE_PTR_MAP_ADAPTER_HPP
|
||||
|
||||
#include <boost/ptr_container/ptr_map_adapter.hpp>
|
||||
#include <boost/ptr_container/detail/serialize_xml_names.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace serialization
|
||||
{
|
||||
|
||||
template<class Archive, class T, class VoidPtrMap, class CloneAllocator, bool Ordered>
|
||||
void save(Archive& ar, const ptr_container_detail::ptr_map_adapter_base<T, VoidPtrMap, CloneAllocator,Ordered>& c, unsigned int /*version*/)
|
||||
{
|
||||
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(),
|
||||
ptr_container_detail::serialize_as_const(c.size()) );
|
||||
|
||||
const_iterator i = c.begin(), e = c.end();
|
||||
for(; i != e; ++i)
|
||||
{
|
||||
ar << boost::serialization::make_nvp( ptr_container_detail::first(), i->first );
|
||||
ar << boost::serialization::make_nvp( ptr_container_detail::second(),
|
||||
ptr_container_detail::serialize_as_const(i->second) );
|
||||
}
|
||||
}
|
||||
|
||||
template<class Archive, class T, class VoidPtrMap, class CloneAllocator, bool Ordered>
|
||||
void load(Archive& ar, ptr_map_adapter<T, VoidPtrMap, CloneAllocator,Ordered>& c, unsigned int /*version*/)
|
||||
{
|
||||
typedef ptr_map_adapter<T, VoidPtrMap, CloneAllocator,Ordered> container;
|
||||
typedef BOOST_DEDUCED_TYPENAME container::key_type key_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME container::size_type size_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME container::iterator iterator;
|
||||
|
||||
c.clear();
|
||||
size_type n;
|
||||
ar >> boost::serialization::make_nvp( ptr_container_detail::count(), n );
|
||||
|
||||
for(size_type i = 0u; i != n; ++i)
|
||||
{
|
||||
key_type key;
|
||||
T* value;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
template<class Archive, class T, class VoidPtrMap, class CloneAllocator, bool Ordered>
|
||||
void load(Archive& ar, ptr_multimap_adapter<T, VoidPtrMap, CloneAllocator,Ordered>& c, unsigned int /*version*/)
|
||||
{
|
||||
typedef ptr_multimap_adapter<T, VoidPtrMap, CloneAllocator,Ordered> container;
|
||||
typedef BOOST_DEDUCED_TYPENAME container::key_type key_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME container::size_type size_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME container::iterator iterator;
|
||||
|
||||
c.clear();
|
||||
size_type n;
|
||||
ar >> boost::serialization::make_nvp( ptr_container_detail::count(), n );
|
||||
|
||||
for(size_type i = 0u; i != n; ++i)
|
||||
{
|
||||
key_type key;
|
||||
T* value;
|
||||
ar >> boost::serialization::make_nvp( ptr_container_detail::first(), key );
|
||||
ar >> boost::serialization::make_nvp( ptr_container_detail::second(), value );
|
||||
iterator p = c.insert(key, value);
|
||||
ar.reset_object_address(&p->first, &key);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace serialization
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
86
test/external/boost/ptr_container/detail/serialize_reversible_cont.hpp
vendored
Normal file
86
test/external/boost/ptr_container/detail/serialize_reversible_cont.hpp
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
// 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)
|
||||
|
||||
#ifndef BOOST_PTR_CONTAINER_DETAIL_SERIALIZE_REVERSIBLE_PTR_CONTAINER_HPP
|
||||
#define BOOST_PTR_CONTAINER_DETAIL_SERIALIZE_REVERSIBLE_PTR_CONTAINER_HPP
|
||||
|
||||
#include <boost/ptr_container/detail/reversible_ptr_container.hpp>
|
||||
#include <boost/ptr_container/detail/serialize_xml_names.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace ptr_container_detail
|
||||
{
|
||||
|
||||
template<class Archive, class Config, class CloneAllocator>
|
||||
void save_helper(Archive& ar, const ptr_container_detail::reversible_ptr_container<Config, CloneAllocator>& c)
|
||||
{
|
||||
typedef ptr_container_detail::reversible_ptr_container<Config, CloneAllocator> container_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME container_type::const_iterator const_iterator;
|
||||
typedef BOOST_DEDUCED_TYPENAME container_type::value_type value_type;
|
||||
|
||||
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())));
|
||||
}
|
||||
|
||||
template<class Archive, class Config, class CloneAllocator>
|
||||
void load_helper(Archive& ar, ptr_container_detail::reversible_ptr_container<Config, CloneAllocator>& c,
|
||||
BOOST_DEDUCED_TYPENAME ptr_container_detail::reversible_ptr_container<Config, CloneAllocator>::size_type n)
|
||||
{
|
||||
typedef ptr_container_detail::reversible_ptr_container<Config, CloneAllocator> container_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME container_type::size_type size_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME container_type::value_type value_type;
|
||||
|
||||
//
|
||||
// Called after an appropriate reserve on c.
|
||||
//
|
||||
|
||||
c.clear();
|
||||
for(size_type i = 0u; i != n; ++i)
|
||||
{
|
||||
//
|
||||
// Remark: pointers are not tracked,
|
||||
// so we need not call ar.reset_object_address(v, u)
|
||||
//
|
||||
value_type ptr;
|
||||
ar >> boost::serialization::make_nvp( ptr_container_detail::item(), ptr );
|
||||
c.insert(c.end(), ptr);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ptr_container_detail
|
||||
|
||||
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(),
|
||||
ptr_container_detail::serialize_as_const(c.size()) );
|
||||
ptr_container_detail::save_helper(ar, c);
|
||||
}
|
||||
|
||||
template<class Archive, class Config, class CloneAllocator>
|
||||
void load(Archive& ar, ptr_container_detail::reversible_ptr_container<Config, CloneAllocator>& c, unsigned int /*version*/)
|
||||
{
|
||||
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
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
32
test/external/boost/ptr_container/detail/serialize_xml_names.hpp
vendored
Normal file
32
test/external/boost/ptr_container/detail/serialize_xml_names.hpp
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// Boost.Pointer Container
|
||||
//
|
||||
// Copyright Thorsten Ottosen 2003-2007. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/ptr_container/
|
||||
//
|
||||
|
||||
#ifndef BOOST_PTR_CONTAINER_DETAIL_SERIALIZE_XML_NAMES
|
||||
#define BOOST_PTR_CONTAINER_DETAIL_SERIALIZE_XML_NAMES
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace ptr_container_detail
|
||||
{
|
||||
inline const char* count() { return "count"; }
|
||||
inline const char* item() { return "item"; }
|
||||
inline const char* first() { return "first"; }
|
||||
inline const char* second() { return "second"; }
|
||||
|
||||
template<class T>
|
||||
inline T const& serialize_as_const(T const& r)
|
||||
{
|
||||
return r;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
211
test/external/boost/ptr_container/detail/static_move_ptr.hpp
vendored
Normal file
211
test/external/boost/ptr_container/detail/static_move_ptr.hpp
vendored
Normal file
@@ -0,0 +1,211 @@
|
||||
// (C) Copyright Thorsten Ottosen 2005.
|
||||
// (C) Copyright Jonathan Turkanis 2004.
|
||||
// (C) Copyright Daniel Wallin 2004.
|
||||
// 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://std.dkuug.dk/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.
|
||||
|
||||
#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/static_assert.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/type_traits/is_array.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4521) // Multiple copy constuctors.
|
||||
#endif
|
||||
|
||||
namespace boost { namespace ptr_container_detail {
|
||||
|
||||
|
||||
template< typename T,
|
||||
typename Deleter =
|
||||
move_ptrs::default_deleter<T> >
|
||||
class static_move_ptr
|
||||
{
|
||||
public:
|
||||
|
||||
typedef typename remove_bounds<T>::type element_type;
|
||||
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;
|
||||
|
||||
public:
|
||||
typedef typename impl_type::second_reference deleter_reference;
|
||||
typedef typename impl_type::second_const_reference deleter_const_reference;
|
||||
|
||||
// Constructors
|
||||
|
||||
static_move_ptr() : impl_(0) { }
|
||||
|
||||
static_move_ptr(const static_move_ptr& p)
|
||||
: impl_(p.get(), p.get_deleter())
|
||||
{
|
||||
const_cast<static_move_ptr&>(p).release();
|
||||
}
|
||||
|
||||
#if BOOST_WORKAROUND(__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
|
||||
: impl_(src.ptr().get(), src.ptr().get_deleter())
|
||||
{
|
||||
src.ptr().release();
|
||||
}
|
||||
|
||||
template<typename TT>
|
||||
explicit static_move_ptr(TT* tt)
|
||||
: impl_(tt, Deleter())
|
||||
{ }
|
||||
|
||||
// Destructor
|
||||
|
||||
~static_move_ptr() { if (ptr()) get_deleter()(ptr()); }
|
||||
|
||||
// Assignment
|
||||
|
||||
static_move_ptr& operator=(static_move_ptr rhs)
|
||||
{
|
||||
rhs.swap(*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Smart pointer interface
|
||||
|
||||
element_type* get() const { return ptr(); }
|
||||
|
||||
element_type& operator*()
|
||||
{
|
||||
/*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();
|
||||
}
|
||||
|
||||
const element_type* operator->() const
|
||||
{
|
||||
/*BOOST_STATIC_ASSERT(!is_array);*/ return ptr();
|
||||
}
|
||||
|
||||
|
||||
element_type* release()
|
||||
{
|
||||
element_type* result = ptr();
|
||||
ptr() = 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
if (ptr()) get_deleter()(ptr());
|
||||
ptr() = 0;
|
||||
}
|
||||
|
||||
template<typename TT>
|
||||
void reset(TT* tt)
|
||||
{
|
||||
static_move_ptr(tt).swap(*this);
|
||||
}
|
||||
|
||||
template<typename TT, typename DD>
|
||||
void reset(TT* tt, DD dd)
|
||||
{
|
||||
static_move_ptr(tt, dd).swap(*this);
|
||||
}
|
||||
|
||||
operator safe_bool() const { return ptr() ? &safe_bool_helper::x : 0; }
|
||||
|
||||
void swap(static_move_ptr& p) { impl_.swap(p.impl_); }
|
||||
|
||||
deleter_reference get_deleter() { return impl_.second(); }
|
||||
|
||||
deleter_const_reference get_deleter() const { return impl_.second(); }
|
||||
private:
|
||||
template<typename TT, typename DD>
|
||||
void check(const static_move_ptr<TT, DD>& ptr)
|
||||
{
|
||||
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
|
||||
|
||||
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 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
|
||||
move_ptrs::enable_if_convertible<
|
||||
TT, T, static_move_ptr&
|
||||
>::type::type* = 0 );
|
||||
|
||||
#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING || BOOST_NO_SFINAE
|
||||
|
||||
//#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
// template<typename TT, typename DD>
|
||||
// friend class static_move_ptr;
|
||||
//#else
|
||||
public:
|
||||
//#endif
|
||||
typename impl_type::first_reference
|
||||
ptr() { return impl_.first(); }
|
||||
|
||||
typename impl_type::first_const_reference
|
||||
ptr() const { return impl_.first(); }
|
||||
|
||||
impl_type impl_;
|
||||
};
|
||||
|
||||
} // namespace ptr_container_detail
|
||||
} // End namespace boost.
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(pop) // #pragma warning(disable:4251)
|
||||
#endif
|
||||
|
||||
#endif // #ifndef BOOST_STATIC_MOVE_PTR_HPP_INCLUDED
|
||||
33
test/external/boost/ptr_container/detail/throw_exception.hpp
vendored
Normal file
33
test/external/boost/ptr_container/detail/throw_exception.hpp
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// Boost.Pointer Container
|
||||
//
|
||||
// Copyright Thorsten Ottosen 2006. 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_DETAIL_THROW_EXCEPTION
|
||||
#define BOOST_PTR_CONTAINER_DETAIL_THROW_EXCEPTION
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#ifdef BOOST_NO_EXCEPTIONS
|
||||
#define BOOST_PTR_CONTAINER_NO_EXCEPTIONS
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_PTR_CONTAINER_NO_EXCEPTIONS
|
||||
|
||||
#define BOOST_PTR_CONTAINER_THROW_EXCEPTION( If, Ex, Msg ) BOOST_ASSERT( !(If) && Msg )
|
||||
|
||||
#else
|
||||
|
||||
#define BOOST_PTR_CONTAINER_THROW_EXCEPTION( If, Ex, Msg ) if( (If) ) throw Ex ( Msg )
|
||||
|
||||
#endif // BOOST_PTR_CONTAINER_NO_EXCEPTIONS
|
||||
|
||||
|
||||
#endif
|
||||
229
test/external/boost/ptr_container/detail/void_ptr_iterator.hpp
vendored
Normal file
229
test/external/boost/ptr_container/detail/void_ptr_iterator.hpp
vendored
Normal file
@@ -0,0 +1,229 @@
|
||||
//
|
||||
// Boost.Pointer Container
|
||||
//
|
||||
// Copyright Thorsten Ottosen 2003-2005. 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_DETAIL_VOID_PTR_ITERATOR_HPP
|
||||
#define BOOST_PTR_CONTAINER_DETAIL_VOID_PTR_ITERATOR_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/iterator/iterator_traits.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template
|
||||
<
|
||||
class VoidIter,
|
||||
class T
|
||||
>
|
||||
class void_ptr_iterator
|
||||
{
|
||||
public:
|
||||
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;
|
||||
typedef BOOST_DEDUCED_TYPENAME iterator_category<VoidIter>::type
|
||||
iterator_category;
|
||||
private:
|
||||
|
||||
VoidIter iter_;
|
||||
|
||||
public:
|
||||
void_ptr_iterator() : iter_()
|
||||
{ }
|
||||
|
||||
void_ptr_iterator( VoidIter r ) : iter_(r)
|
||||
{ }
|
||||
|
||||
//
|
||||
// Remark: passing by value breaks vc7.1
|
||||
//
|
||||
template< class MutableIterator, class MutableT >
|
||||
void_ptr_iterator( const void_ptr_iterator<MutableIterator,MutableT>& r )
|
||||
#ifdef BOOST_NO_SFINAE
|
||||
: iter_( VoidIter(const_cast<void**>(&*r.base())) )
|
||||
#else
|
||||
|
||||
: iter_(r.base())
|
||||
#endif
|
||||
{ }
|
||||
|
||||
T& operator*() const
|
||||
{
|
||||
return *static_cast<T*>( *iter_ );
|
||||
}
|
||||
|
||||
T* operator->() const
|
||||
{
|
||||
return static_cast<T*>( *iter_ );
|
||||
}
|
||||
|
||||
void_ptr_iterator& operator++()
|
||||
{
|
||||
++iter_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void_ptr_iterator operator++(int)
|
||||
{
|
||||
void_ptr_iterator res = *this;
|
||||
++iter_;
|
||||
return res;
|
||||
}
|
||||
|
||||
void_ptr_iterator& operator--()
|
||||
{
|
||||
--iter_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void_ptr_iterator operator--(int)
|
||||
{
|
||||
void_ptr_iterator res = *this;
|
||||
--iter_;
|
||||
return res;
|
||||
}
|
||||
|
||||
void_ptr_iterator& operator+=( difference_type n )
|
||||
{
|
||||
iter_ += n;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void_ptr_iterator& operator-=( difference_type n )
|
||||
{
|
||||
iter_ -= n;
|
||||
return *this;
|
||||
}
|
||||
|
||||
T& operator[]( difference_type n ) const
|
||||
{
|
||||
return *static_cast<T*>( *(iter_ + n) );
|
||||
}
|
||||
|
||||
VoidIter base() const
|
||||
{
|
||||
return iter_;
|
||||
}
|
||||
|
||||
}; // class 'void_ptr_iterator'
|
||||
|
||||
template< class VoidIter, class T >
|
||||
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;
|
||||
return l;
|
||||
}
|
||||
|
||||
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 )
|
||||
|
||||
{
|
||||
r += n;
|
||||
return r;
|
||||
}
|
||||
|
||||
template< class VoidIter, class T >
|
||||
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;
|
||||
return l;
|
||||
}
|
||||
|
||||
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 )
|
||||
|
||||
{
|
||||
r -= n;
|
||||
return r;
|
||||
}
|
||||
|
||||
template< class VoidIter, class T, class VoidIterU, class U >
|
||||
inline BOOST_DEDUCED_TYPENAME void_ptr_iterator<VoidIter,T>::difference_type
|
||||
operator-( void_ptr_iterator<VoidIter,T> l,
|
||||
void_ptr_iterator<VoidIterU,U> r )
|
||||
|
||||
{
|
||||
return l.base() - r.base();
|
||||
}
|
||||
|
||||
|
||||
|
||||
template< class VoidIterT, class T, class VoidIterU, class U >
|
||||
inline bool operator==( const void_ptr_iterator<VoidIterT,T>& l,
|
||||
const void_ptr_iterator<VoidIterU,U>& r )
|
||||
{
|
||||
return l.base() == r.base();
|
||||
}
|
||||
|
||||
|
||||
|
||||
template< class VoidIterT, class T, class VoidIterU, class U >
|
||||
inline bool operator!=( const void_ptr_iterator<VoidIterT,T>& l,
|
||||
const void_ptr_iterator<VoidIterU,U>& r )
|
||||
{
|
||||
return l.base() != r.base();
|
||||
}
|
||||
|
||||
|
||||
|
||||
template< class VoidIterT, class T, class VoidIterU, class U >
|
||||
inline bool operator<( const void_ptr_iterator<VoidIterT,T>& l,
|
||||
const void_ptr_iterator<VoidIterU,U>& r )
|
||||
{
|
||||
return l.base() < r.base();
|
||||
}
|
||||
|
||||
|
||||
|
||||
template< class VoidIterT, class T, class VoidIterU, class U >
|
||||
inline bool operator<=( const void_ptr_iterator<VoidIterT,T>& l,
|
||||
const void_ptr_iterator<VoidIterU,U>& r )
|
||||
{
|
||||
return l.base() <= r.base();
|
||||
}
|
||||
|
||||
|
||||
|
||||
template< class VoidIterT, class T, class VoidIterU, class U >
|
||||
inline bool operator>( const void_ptr_iterator<VoidIterT,T>& l,
|
||||
const void_ptr_iterator<VoidIterU,U>& r )
|
||||
{
|
||||
return l.base() > r.base();
|
||||
}
|
||||
|
||||
|
||||
|
||||
template< class VoidIterT, class T, class VoidIterU, class U >
|
||||
inline bool operator>=( const void_ptr_iterator<VoidIterT,T>& l,
|
||||
const void_ptr_iterator<VoidIterU,U>& r )
|
||||
{
|
||||
return l.base() >= r.base();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user