Added boost header
This commit is contained in:
300
test/external/boost/intrusive/detail/any_node_and_algorithms.hpp
vendored
Normal file
300
test/external/boost/intrusive/detail/any_node_and_algorithms.hpp
vendored
Normal file
@@ -0,0 +1,300 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2006-2009
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/intrusive for documentation.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_ANY_NODE_HPP
|
||||
#define BOOST_INTRUSIVE_ANY_NODE_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <iterator>
|
||||
#include <boost/intrusive/detail/assert.hpp>
|
||||
#include <boost/intrusive/detail/pointer_to_other.hpp>
|
||||
#include <cstddef>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/pointer_cast.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
||||
template<class VoidPointer>
|
||||
struct any_node
|
||||
{
|
||||
typedef typename boost::pointer_to_other
|
||||
<VoidPointer, any_node>::type node_ptr;
|
||||
node_ptr node_ptr_1;
|
||||
node_ptr node_ptr_2;
|
||||
node_ptr node_ptr_3;
|
||||
std::size_t size_t_1;
|
||||
};
|
||||
|
||||
template<class VoidPointer>
|
||||
struct any_list_node_traits
|
||||
{
|
||||
typedef any_node<VoidPointer> node;
|
||||
typedef typename boost::pointer_to_other
|
||||
<VoidPointer, node>::type node_ptr;
|
||||
typedef typename boost::pointer_to_other
|
||||
<VoidPointer, const node>::type const_node_ptr;
|
||||
|
||||
static node_ptr get_next(const_node_ptr n)
|
||||
{ return n->node_ptr_1; }
|
||||
|
||||
static void set_next(node_ptr n, node_ptr next)
|
||||
{ n->node_ptr_1 = next; }
|
||||
|
||||
static node_ptr get_previous(const_node_ptr n)
|
||||
{ return n->node_ptr_2; }
|
||||
|
||||
static void set_previous(node_ptr n, node_ptr prev)
|
||||
{ n->node_ptr_2 = prev; }
|
||||
};
|
||||
|
||||
|
||||
template<class VoidPointer>
|
||||
struct any_slist_node_traits
|
||||
{
|
||||
typedef any_node<VoidPointer> node;
|
||||
typedef typename boost::pointer_to_other
|
||||
<VoidPointer, node>::type node_ptr;
|
||||
typedef typename boost::pointer_to_other
|
||||
<VoidPointer, const node>::type const_node_ptr;
|
||||
|
||||
static node_ptr get_next(const_node_ptr n)
|
||||
{ return n->node_ptr_1; }
|
||||
|
||||
static void set_next(node_ptr n, node_ptr next)
|
||||
{ n->node_ptr_1 = next; }
|
||||
};
|
||||
|
||||
|
||||
template<class VoidPointer>
|
||||
struct any_unordered_node_traits
|
||||
: public any_slist_node_traits<VoidPointer>
|
||||
{
|
||||
typedef any_slist_node_traits<VoidPointer> reduced_slist_node_traits;
|
||||
typedef typename reduced_slist_node_traits::node node;
|
||||
typedef typename reduced_slist_node_traits::node_ptr node_ptr;
|
||||
typedef typename reduced_slist_node_traits::const_node_ptr const_node_ptr;
|
||||
|
||||
static const bool store_hash = true;
|
||||
static const bool optimize_multikey = true;
|
||||
|
||||
static node_ptr get_next(const_node_ptr n)
|
||||
{
|
||||
using ::boost::static_pointer_cast;
|
||||
return static_pointer_cast<node>(n->node_ptr_1);
|
||||
}
|
||||
|
||||
static void set_next(node_ptr n, node_ptr next)
|
||||
{ n->node_ptr_1 = next; }
|
||||
|
||||
static node_ptr get_prev_in_group(const_node_ptr n)
|
||||
{ return n->node_ptr_2; }
|
||||
|
||||
static void set_prev_in_group(node_ptr n, node_ptr prev)
|
||||
{ n->node_ptr_2 = prev; }
|
||||
|
||||
static std::size_t get_hash(const_node_ptr n)
|
||||
{ return n->size_t_1; }
|
||||
|
||||
static void set_hash(node_ptr n, std::size_t h)
|
||||
{ n->size_t_1 = h; }
|
||||
};
|
||||
|
||||
|
||||
template<class VoidPointer>
|
||||
struct any_rbtree_node_traits
|
||||
{
|
||||
typedef any_node<VoidPointer> node;
|
||||
|
||||
typedef typename boost::pointer_to_other
|
||||
<VoidPointer, node>::type node_ptr;
|
||||
typedef typename boost::pointer_to_other
|
||||
<VoidPointer, const node>::type const_node_ptr;
|
||||
|
||||
typedef std::size_t color;
|
||||
|
||||
static node_ptr get_parent(const_node_ptr n)
|
||||
{ return n->node_ptr_1; }
|
||||
|
||||
static void set_parent(node_ptr n, node_ptr p)
|
||||
{ n->node_ptr_1 = p; }
|
||||
|
||||
static node_ptr get_left(const_node_ptr n)
|
||||
{ return n->node_ptr_2; }
|
||||
|
||||
static void set_left(node_ptr n, node_ptr l)
|
||||
{ n->node_ptr_2 = l; }
|
||||
|
||||
static node_ptr get_right(const_node_ptr n)
|
||||
{ return n->node_ptr_3; }
|
||||
|
||||
static void set_right(node_ptr n, node_ptr r)
|
||||
{ n->node_ptr_3 = r; }
|
||||
|
||||
static color get_color(const_node_ptr n)
|
||||
{ return n->size_t_1; }
|
||||
|
||||
static void set_color(node_ptr n, color c)
|
||||
{ n->size_t_1 = c; }
|
||||
|
||||
static color black()
|
||||
{ return 0u; }
|
||||
|
||||
static color red()
|
||||
{ return 1u; }
|
||||
};
|
||||
|
||||
|
||||
template<class VoidPointer>
|
||||
struct any_avltree_node_traits
|
||||
{
|
||||
typedef any_node<VoidPointer> node;
|
||||
|
||||
typedef typename boost::pointer_to_other
|
||||
<VoidPointer, node>::type node_ptr;
|
||||
typedef typename boost::pointer_to_other
|
||||
<VoidPointer, const node>::type const_node_ptr;
|
||||
typedef std::size_t balance;
|
||||
|
||||
static node_ptr get_parent(const_node_ptr n)
|
||||
{ return n->node_ptr_1; }
|
||||
|
||||
static void set_parent(node_ptr n, node_ptr p)
|
||||
{ n->node_ptr_1 = p; }
|
||||
|
||||
static node_ptr get_left(const_node_ptr n)
|
||||
{ return n->node_ptr_2; }
|
||||
|
||||
static void set_left(node_ptr n, node_ptr l)
|
||||
{ n->node_ptr_2 = l; }
|
||||
|
||||
static node_ptr get_right(const_node_ptr n)
|
||||
{ return n->node_ptr_3; }
|
||||
|
||||
static void set_right(node_ptr n, node_ptr r)
|
||||
{ n->node_ptr_3 = r; }
|
||||
|
||||
static balance get_balance(const_node_ptr n)
|
||||
{ return n->size_t_1; }
|
||||
|
||||
static void set_balance(node_ptr n, balance b)
|
||||
{ n->size_t_1 = b; }
|
||||
|
||||
static balance negative()
|
||||
{ return 0u; }
|
||||
|
||||
static balance zero()
|
||||
{ return 1u; }
|
||||
|
||||
static balance positive()
|
||||
{ return 2u; }
|
||||
};
|
||||
|
||||
|
||||
template<class VoidPointer>
|
||||
struct any_tree_node_traits
|
||||
{
|
||||
typedef any_node<VoidPointer> node;
|
||||
|
||||
typedef typename boost::pointer_to_other
|
||||
<VoidPointer, node>::type node_ptr;
|
||||
typedef typename boost::pointer_to_other
|
||||
<VoidPointer, const node>::type const_node_ptr;
|
||||
|
||||
static node_ptr get_parent(const_node_ptr n)
|
||||
{ return n->node_ptr_1; }
|
||||
|
||||
static void set_parent(node_ptr n, node_ptr p)
|
||||
{ n->node_ptr_1 = p; }
|
||||
|
||||
static node_ptr get_left(const_node_ptr n)
|
||||
{ return n->node_ptr_2; }
|
||||
|
||||
static void set_left(node_ptr n, node_ptr l)
|
||||
{ n->node_ptr_2 = l; }
|
||||
|
||||
static node_ptr get_right(const_node_ptr n)
|
||||
{ return n->node_ptr_3; }
|
||||
|
||||
static void set_right(node_ptr n, node_ptr r)
|
||||
{ n->node_ptr_3 = r; }
|
||||
};
|
||||
|
||||
template<class VoidPointer>
|
||||
class any_node_traits
|
||||
{
|
||||
public:
|
||||
typedef any_node<VoidPointer> node;
|
||||
typedef typename boost::pointer_to_other
|
||||
<VoidPointer, node>::type node_ptr;
|
||||
typedef typename boost::pointer_to_other
|
||||
<VoidPointer, const node>::type const_node_ptr;
|
||||
};
|
||||
|
||||
template<class VoidPointer>
|
||||
class any_algorithms
|
||||
{
|
||||
template <class T>
|
||||
static void function_not_available_for_any_hooks(typename detail::enable_if<detail::is_same<T, bool> >::type)
|
||||
{}
|
||||
|
||||
public:
|
||||
typedef any_node<VoidPointer> node;
|
||||
typedef typename boost::pointer_to_other
|
||||
<VoidPointer, node>::type node_ptr;
|
||||
typedef typename boost::pointer_to_other
|
||||
<VoidPointer, const node>::type const_node_ptr;
|
||||
typedef any_node_traits<VoidPointer> node_traits;
|
||||
|
||||
//! <b>Requires</b>: node must not be part of any tree.
|
||||
//!
|
||||
//! <b>Effects</b>: After the function unique(node) == true.
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
||||
static void init(node_ptr node)
|
||||
{ node->node_ptr_1 = 0; };
|
||||
|
||||
//! <b>Effects</b>: Returns true if node is in the same state as if called init(node)
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
static bool inited(const_node_ptr node)
|
||||
{ return !node->node_ptr_1; };
|
||||
|
||||
static bool unique(const_node_ptr node)
|
||||
{ return 0 == node->node_ptr_1; }
|
||||
|
||||
static void unlink(node_ptr)
|
||||
{
|
||||
//Auto-unlink hooks and unlink() are not available for any hooks
|
||||
any_algorithms<VoidPointer>::template function_not_available_for_any_hooks<node_ptr>();
|
||||
}
|
||||
|
||||
static void swap_nodes(node_ptr l, node_ptr r)
|
||||
{
|
||||
//Any nodes have no swap_nodes capability because they don't know
|
||||
//what algorithm they must use to unlink the node from the container
|
||||
any_algorithms<VoidPointer>::template function_not_available_for_any_hooks<node_ptr>();
|
||||
}
|
||||
};
|
||||
|
||||
} //namespace intrusive
|
||||
} //namespace boost
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
#endif //BOOST_INTRUSIVE_ANY_NODE_HPP
|
||||
41
test/external/boost/intrusive/detail/assert.hpp
vendored
Normal file
41
test/external/boost/intrusive/detail/assert.hpp
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2006-2009
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/intrusive for documentation.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_DETAIL_ASSERT_HPP
|
||||
#define BOOST_INTRUSIVE_DETAIL_ASSERT_HPP
|
||||
|
||||
#if defined(_MSC_VER)&&(_MSC_VER>=1200)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_INVARIANT_ASSERT)
|
||||
#include <boost/assert.hpp>
|
||||
#define BOOST_INTRUSIVE_INVARIANT_ASSERT BOOST_ASSERT
|
||||
#elif defined(BOOST_INTRUSIVE_INVARIANT_ASSERT_INCLUDE)
|
||||
#include BOOST_INTRUSIVE_INVARIANT_ASSERT_INCLUDE
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT)
|
||||
#include <boost/assert.hpp>
|
||||
#define BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT BOOST_ASSERT
|
||||
#elif defined(BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT_INCLUDE)
|
||||
#include BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT_INCLUDE
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_SAFE_HOOK_DESTRUCTOR_ASSERT)
|
||||
#include <boost/assert.hpp>
|
||||
#define BOOST_INTRUSIVE_SAFE_HOOK_DESTRUCTOR_ASSERT BOOST_ASSERT
|
||||
#elif defined(BOOST_INTRUSIVE_SAFE_HOOK_DESTRUCTOR_ASSERT_INCLUDE)
|
||||
#include BOOST_INTRUSIVE_SAFE_HOOK_DESTRUCTOR_ASSERT_INCLUDE
|
||||
#endif
|
||||
|
||||
#endif //BOOST_INTRUSIVE_DETAIL_ASSERT_HPP
|
||||
179
test/external/boost/intrusive/detail/avltree_node.hpp
vendored
Normal file
179
test/external/boost/intrusive/detail/avltree_node.hpp
vendored
Normal file
@@ -0,0 +1,179 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 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)
|
||||
//
|
||||
// See http://www.boost.org/libs/intrusive for documentation.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_AVLTREE_NODE_HPP
|
||||
#define BOOST_INTRUSIVE_AVLTREE_NODE_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <iterator>
|
||||
#include <boost/intrusive/detail/pointer_to_other.hpp>
|
||||
#include <boost/intrusive/avltree_algorithms.hpp>
|
||||
#include <boost/intrusive/pointer_plus_bits.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// Generic node_traits for any pointer type //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//This is the compact representation: 3 pointers
|
||||
template<class VoidPointer>
|
||||
struct compact_avltree_node
|
||||
{
|
||||
typedef typename pointer_to_other
|
||||
<VoidPointer
|
||||
,compact_avltree_node<VoidPointer> >::type node_ptr;
|
||||
enum balance { negative_t, zero_t, positive_t };
|
||||
node_ptr parent_, left_, right_;
|
||||
};
|
||||
|
||||
//This is the normal representation: 3 pointers + enum
|
||||
template<class VoidPointer>
|
||||
struct avltree_node
|
||||
{
|
||||
typedef typename pointer_to_other
|
||||
<VoidPointer
|
||||
,avltree_node<VoidPointer> >::type node_ptr;
|
||||
enum balance { negative_t, zero_t, positive_t };
|
||||
node_ptr parent_, left_, right_;
|
||||
balance balance_;
|
||||
};
|
||||
|
||||
//This is the default node traits implementation
|
||||
//using a node with 3 generic pointers plus an enum
|
||||
template<class VoidPointer>
|
||||
struct default_avltree_node_traits_impl
|
||||
{
|
||||
typedef avltree_node<VoidPointer> node;
|
||||
|
||||
typedef typename boost::pointer_to_other
|
||||
<VoidPointer, node>::type node_ptr;
|
||||
typedef typename boost::pointer_to_other
|
||||
<VoidPointer, const node>::type const_node_ptr;
|
||||
typedef typename node::balance balance;
|
||||
|
||||
static node_ptr get_parent(const_node_ptr n)
|
||||
{ return n->parent_; }
|
||||
|
||||
static void set_parent(node_ptr n, node_ptr p)
|
||||
{ n->parent_ = p; }
|
||||
|
||||
static node_ptr get_left(const_node_ptr n)
|
||||
{ return n->left_; }
|
||||
|
||||
static void set_left(node_ptr n, node_ptr l)
|
||||
{ n->left_ = l; }
|
||||
|
||||
static node_ptr get_right(const_node_ptr n)
|
||||
{ return n->right_; }
|
||||
|
||||
static void set_right(node_ptr n, node_ptr r)
|
||||
{ n->right_ = r; }
|
||||
|
||||
static balance get_balance(const_node_ptr n)
|
||||
{ return n->balance_; }
|
||||
|
||||
static void set_balance(node_ptr n, balance b)
|
||||
{ n->balance_ = b; }
|
||||
|
||||
static balance negative()
|
||||
{ return node::negative_t; }
|
||||
|
||||
static balance zero()
|
||||
{ return node::zero_t; }
|
||||
|
||||
static balance positive()
|
||||
{ return node::positive_t; }
|
||||
};
|
||||
|
||||
//This is the compact node traits implementation
|
||||
//using a node with 3 generic pointers
|
||||
template<class VoidPointer>
|
||||
struct compact_avltree_node_traits_impl
|
||||
{
|
||||
typedef compact_avltree_node<VoidPointer> node;
|
||||
typedef typename boost::pointer_to_other
|
||||
<VoidPointer, node>::type node_ptr;
|
||||
typedef typename boost::pointer_to_other
|
||||
<VoidPointer, const node>::type const_node_ptr;
|
||||
typedef typename node::balance balance;
|
||||
|
||||
typedef pointer_plus_bits<node_ptr, 2> ptr_bit;
|
||||
|
||||
static node_ptr get_parent(const_node_ptr n)
|
||||
{ return ptr_bit::get_pointer(n->parent_); }
|
||||
|
||||
static void set_parent(node_ptr n, node_ptr p)
|
||||
{ ptr_bit::set_pointer(n->parent_, p); }
|
||||
|
||||
static node_ptr get_left(const_node_ptr n)
|
||||
{ return n->left_; }
|
||||
|
||||
static void set_left(node_ptr n, node_ptr l)
|
||||
{ n->left_ = l; }
|
||||
|
||||
static node_ptr get_right(const_node_ptr n)
|
||||
{ return n->right_; }
|
||||
|
||||
static void set_right(node_ptr n, node_ptr r)
|
||||
{ n->right_ = r; }
|
||||
|
||||
static balance get_balance(const_node_ptr n)
|
||||
{ return (balance)ptr_bit::get_bits(n->parent_); }
|
||||
|
||||
static void set_balance(node_ptr n, balance b)
|
||||
{ ptr_bit::set_bits(n->parent_, (std::size_t)b); }
|
||||
|
||||
static balance negative()
|
||||
{ return node::negative_t; }
|
||||
|
||||
static balance zero()
|
||||
{ return node::zero_t; }
|
||||
|
||||
static balance positive()
|
||||
{ return node::positive_t; }
|
||||
};
|
||||
|
||||
//Dispatches the implementation based on the boolean
|
||||
template<class VoidPointer, bool Compact>
|
||||
struct avltree_node_traits_dispatch
|
||||
: public default_avltree_node_traits_impl<VoidPointer>
|
||||
{};
|
||||
|
||||
template<class VoidPointer>
|
||||
struct avltree_node_traits_dispatch<VoidPointer, true>
|
||||
: public compact_avltree_node_traits_impl<VoidPointer>
|
||||
{};
|
||||
|
||||
//Inherit from the detail::link_dispatch depending on the embedding capabilities
|
||||
template<class VoidPointer, bool OptimizeSize = false>
|
||||
struct avltree_node_traits
|
||||
: public avltree_node_traits_dispatch
|
||||
< VoidPointer
|
||||
, OptimizeSize &&
|
||||
max_pointer_plus_bits
|
||||
< VoidPointer
|
||||
, detail::alignment_of<compact_avltree_node<VoidPointer> >::value
|
||||
>::value >= 2u
|
||||
>
|
||||
{};
|
||||
|
||||
} //namespace intrusive
|
||||
} //namespace boost
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
#endif //BOOST_INTRUSIVE_AVLTREE_NODE_HPP
|
||||
36
test/external/boost/intrusive/detail/clear_on_destructor_base.hpp
vendored
Normal file
36
test/external/boost/intrusive/detail/clear_on_destructor_base.hpp
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
//////} // ///////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2008-2009. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/intrusive for documentation.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_DETAIL_CLEAR_ON_DESTRUCTOR_HPP
|
||||
#define BOOST_INTRUSIVE_DETAIL_CLEAR_ON_DESTRUCTOR_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
namespace detail {
|
||||
|
||||
template<class Derived>
|
||||
class clear_on_destructor_base
|
||||
{
|
||||
protected:
|
||||
~clear_on_destructor_base()
|
||||
{
|
||||
static_cast<Derived*>(this)->clear();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail {
|
||||
} // namespace intrusive {
|
||||
} // namespace boost {
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
#endif //#ifndef BOOST_INTRUSIVE_DETAIL_CLEAR_ON_DESTRUCTOR_HPP
|
||||
103
test/external/boost/intrusive/detail/common_slist_algorithms.hpp
vendored
Normal file
103
test/external/boost/intrusive/detail/common_slist_algorithms.hpp
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2007-2009
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/intrusive for documentation.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_COMMON_SLIST_ALGORITHMS_HPP
|
||||
#define BOOST_INTRUSIVE_COMMON_SLIST_ALGORITHMS_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <boost/intrusive/intrusive_fwd.hpp>
|
||||
#include <boost/intrusive/detail/assert.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
namespace detail {
|
||||
|
||||
template<class NodeTraits>
|
||||
class common_slist_algorithms
|
||||
{
|
||||
public:
|
||||
typedef typename NodeTraits::node node;
|
||||
typedef typename NodeTraits::node_ptr node_ptr;
|
||||
typedef typename NodeTraits::const_node_ptr const_node_ptr;
|
||||
typedef NodeTraits node_traits;
|
||||
|
||||
static node_ptr get_previous_node(node_ptr prev_init_node, node_ptr this_node)
|
||||
{
|
||||
node_ptr p = prev_init_node;
|
||||
for( node_ptr p_next
|
||||
; this_node != (p_next = NodeTraits::get_next(p))
|
||||
; p = p_next){
|
||||
//Logic error: possible use of linear lists with
|
||||
//operations only permitted with lists
|
||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(p);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
static void init_header(node_ptr this_node)
|
||||
{ NodeTraits::set_next(this_node, this_node); }
|
||||
|
||||
static void init(node_ptr this_node)
|
||||
{ NodeTraits::set_next(this_node, node_ptr(0)); }
|
||||
|
||||
static bool unique(const_node_ptr this_node)
|
||||
{
|
||||
node_ptr next = NodeTraits::get_next(this_node);
|
||||
return !next || next == this_node;
|
||||
}
|
||||
|
||||
static bool inited(const_node_ptr this_node)
|
||||
{ return !NodeTraits::get_next(this_node); }
|
||||
|
||||
static void unlink_after(node_ptr prev_node)
|
||||
{
|
||||
node_ptr this_node(NodeTraits::get_next(prev_node));
|
||||
NodeTraits::set_next(prev_node, NodeTraits::get_next(this_node));
|
||||
}
|
||||
|
||||
static void unlink_after(node_ptr prev_node, node_ptr last_node)
|
||||
{ NodeTraits::set_next(prev_node, last_node); }
|
||||
|
||||
static void link_after(node_ptr prev_node, node_ptr this_node)
|
||||
{
|
||||
NodeTraits::set_next(this_node, NodeTraits::get_next(prev_node));
|
||||
NodeTraits::set_next(prev_node, this_node);
|
||||
}
|
||||
|
||||
static void incorporate_after(node_ptr bp, node_ptr b, node_ptr be)
|
||||
{
|
||||
node_ptr p(NodeTraits::get_next(bp));
|
||||
NodeTraits::set_next(bp, b);
|
||||
NodeTraits::set_next(be, p);
|
||||
}
|
||||
|
||||
static void transfer_after(node_ptr bp, node_ptr bb, node_ptr be)
|
||||
{
|
||||
if (bp != bb && bp != be && bb != be) {
|
||||
node_ptr next_b = NodeTraits::get_next(bb);
|
||||
node_ptr next_e = NodeTraits::get_next(be);
|
||||
node_ptr next_p = NodeTraits::get_next(bp);
|
||||
NodeTraits::set_next(bb, next_e);
|
||||
NodeTraits::set_next(be, next_p);
|
||||
NodeTraits::set_next(bp, next_b);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} //namespace detail
|
||||
} //namespace intrusive
|
||||
} //namespace boost
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
#endif //BOOST_INTRUSIVE_COMMON_SLIST_ALGORITHMS_HPP
|
||||
52
test/external/boost/intrusive/detail/config_begin.hpp
vendored
Normal file
52
test/external/boost/intrusive/detail/config_begin.hpp
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2006-2009
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/intrusive for documentation.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_CONFIG_INCLUDED
|
||||
#define BOOST_INTRUSIVE_CONFIG_INCLUDED
|
||||
#include <boost/config.hpp>
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
|
||||
#pragma warning (push)
|
||||
//
|
||||
//'function' : resolved overload was found by argument-dependent lookup
|
||||
//A function found by argument-dependent lookup (Koenig lookup) was eventually
|
||||
//chosen by overload resolution.
|
||||
//
|
||||
//In Visual C++ .NET and earlier compilers, a different function would have
|
||||
//been called. To pick the original function, use an explicitly qualified name.
|
||||
//
|
||||
|
||||
//warning C4275: non dll-interface class 'x' used as base for
|
||||
//dll-interface class 'Y'
|
||||
#pragma warning (disable : 4275)
|
||||
//warning C4251: 'x' : class 'y' needs to have dll-interface to
|
||||
//be used by clients of class 'z'
|
||||
#pragma warning (disable : 4251)
|
||||
#pragma warning (disable : 4675)
|
||||
#pragma warning (disable : 4996)
|
||||
#pragma warning (disable : 4503)
|
||||
#pragma warning (disable : 4284) // odd return type for operator->
|
||||
#pragma warning (disable : 4244) // possible loss of data
|
||||
#pragma warning (disable : 4521) ////Disable "multiple copy constructors specified"
|
||||
#pragma warning (disable : 4522)
|
||||
#pragma warning (disable : 4146)
|
||||
#pragma warning (disable : 4267) //conversion from 'X' to 'Y', possible loss of data
|
||||
#pragma warning (disable : 4127) //conditional expression is constant
|
||||
#pragma warning (disable : 4706) //assignment within conditional expression
|
||||
#pragma warning (disable : 4541) //'typeid' used on polymorphic type 'boost::exception' with /GR-
|
||||
#pragma warning (disable : 4512) //'typeid' used on polymorphic type 'boost::exception' with /GR-
|
||||
#endif
|
||||
|
||||
//#define BOOST_INTRUSIVE_USE_ITERATOR_FACADE
|
||||
//#define BOOST_INTRUSIVE_USE_ITERATOR_ENABLE_IF_CONVERTIBLE
|
||||
15
test/external/boost/intrusive/detail/config_end.hpp
vendored
Normal file
15
test/external/boost/intrusive/detail/config_end.hpp
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2006-2009
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/intrusive for documentation.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if defined BOOST_MSVC
|
||||
#pragma warning (pop)
|
||||
#endif
|
||||
95
test/external/boost/intrusive/detail/ebo_functor_holder.hpp
vendored
Normal file
95
test/external/boost/intrusive/detail/ebo_functor_holder.hpp
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Joaquin M Lopez Munoz 2006-2009
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/intrusive for documentation.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_DETAIL_EBO_HOLDER_HPP
|
||||
#define BOOST_INTRUSIVE_DETAIL_EBO_HOLDER_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
namespace detail {
|
||||
|
||||
template<typename T, bool IsEmpty = true>
|
||||
class ebo_functor_holder_impl
|
||||
{
|
||||
public:
|
||||
ebo_functor_holder_impl()
|
||||
{}
|
||||
ebo_functor_holder_impl(const T& t)
|
||||
: t_(t)
|
||||
{}
|
||||
template<class Arg1, class Arg2>
|
||||
ebo_functor_holder_impl(const Arg1& arg1, const Arg2& arg2)
|
||||
: t_(arg1, arg2)
|
||||
{}
|
||||
|
||||
T& get(){return t_;}
|
||||
const T& get()const{return t_;}
|
||||
|
||||
private:
|
||||
T t_;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class ebo_functor_holder_impl<T, false>
|
||||
: public T
|
||||
{
|
||||
public:
|
||||
ebo_functor_holder_impl()
|
||||
{}
|
||||
ebo_functor_holder_impl(const T& t)
|
||||
: T(t)
|
||||
{}
|
||||
template<class Arg1, class Arg2>
|
||||
ebo_functor_holder_impl(const Arg1& arg1, const Arg2& arg2)
|
||||
: T(arg1, arg2)
|
||||
{}
|
||||
|
||||
T& get(){return *this;}
|
||||
const T& get()const{return *this;}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class ebo_functor_holder
|
||||
: public ebo_functor_holder_impl<T, is_unary_or_binary_function<T>::value>
|
||||
{
|
||||
private:
|
||||
typedef ebo_functor_holder_impl<T, is_unary_or_binary_function<T>::value> super;
|
||||
|
||||
public:
|
||||
ebo_functor_holder(){}
|
||||
ebo_functor_holder(const T& t)
|
||||
: super(t)
|
||||
{}
|
||||
|
||||
template<class Arg1, class Arg2>
|
||||
ebo_functor_holder(const Arg1& arg1, const Arg2& arg2)
|
||||
: super(arg1, arg2)
|
||||
{}
|
||||
|
||||
ebo_functor_holder& operator=(const ebo_functor_holder& x)
|
||||
{
|
||||
this->get()=x.get();
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
} //namespace detail {
|
||||
} //namespace intrusive {
|
||||
} //namespace boost {
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
#endif //#ifndef BOOST_INTRUSIVE_DETAIL_EBO_HOLDER_HPP
|
||||
87
test/external/boost/intrusive/detail/function_detector.hpp
vendored
Normal file
87
test/external/boost/intrusive/detail/function_detector.hpp
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2009-2009.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/intrusive for documentation.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// This code was modified from the code posted by Alexandre Courpron in his
|
||||
// article "Interface Detection" in The Code Project:
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright 2007 Alexandre Courpron
|
||||
//
|
||||
// Permission to use, copy, modify, redistribute and sell this software,
|
||||
// provided that this copyright notice appears on all copies of the software.
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_DETAIL_FUNCTION_DETECTOR_HPP
|
||||
#define BOOST_INTRUSIVE_DETAIL_FUNCTION_DETECTOR_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
namespace function_detector {
|
||||
|
||||
typedef char NotFoundType;
|
||||
struct StaticFunctionType { NotFoundType x [2]; };
|
||||
struct NonStaticFunctionType { NotFoundType x [3]; };
|
||||
|
||||
enum
|
||||
{ NotFound = 0,
|
||||
StaticFunction = sizeof( StaticFunctionType ) - sizeof( NotFoundType ),
|
||||
NonStaticFunction = sizeof( NonStaticFunctionType ) - sizeof( NotFoundType )
|
||||
};
|
||||
|
||||
} //namespace boost {
|
||||
} //namespace intrusive {
|
||||
} //namespace function_detector {
|
||||
|
||||
#define BOOST_INTRUSIVE_CREATE_FUNCTION_DETECTOR(Identifier, InstantiationKey) \
|
||||
namespace boost { \
|
||||
namespace intrusive { \
|
||||
namespace function_detector { \
|
||||
template < class T, \
|
||||
class NonStaticType, \
|
||||
class NonStaticConstType, \
|
||||
class StaticType > \
|
||||
class DetectMember_##InstantiationKey_##Identifier { \
|
||||
template < NonStaticType > \
|
||||
struct TestNonStaticNonConst ; \
|
||||
\
|
||||
template < NonStaticConstType > \
|
||||
struct TestNonStaticConst ; \
|
||||
\
|
||||
template < StaticType > \
|
||||
struct TestStatic ; \
|
||||
\
|
||||
template <class U > \
|
||||
static NonStaticFunctionType Test( TestNonStaticNonConst<&U::Identifier>*, int ); \
|
||||
\
|
||||
template <class U > \
|
||||
static NonStaticFunctionType Test( TestNonStaticConst<&U::Identifier>*, int ); \
|
||||
\
|
||||
template <class U> \
|
||||
static StaticFunctionType Test( TestStatic<&U::Identifier>*, int ); \
|
||||
\
|
||||
template <class U> \
|
||||
static NotFoundType Test( ... ); \
|
||||
public : \
|
||||
static const int check = NotFound + (sizeof(Test<T>(0, 0)) - sizeof(NotFoundType));\
|
||||
};\
|
||||
}}} //namespace boost::intrusive::function_detector {
|
||||
|
||||
#define BOOST_INTRUSIVE_DETECT_FUNCTION(Class, InstantiationKey, ReturnType, Identifier, Params) \
|
||||
::boost::intrusive::function_detector::DetectMember_##InstantiationKey_##Identifier< Class,\
|
||||
ReturnType (Class::*)Params,\
|
||||
ReturnType (Class::*)Params const,\
|
||||
ReturnType (*)Params \
|
||||
>::check
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
#endif //@ifndef BOOST_INTRUSIVE_DETAIL_FUNCTION_DETECTOR_HPP
|
||||
203
test/external/boost/intrusive/detail/generic_hook.hpp
vendored
Normal file
203
test/external/boost/intrusive/detail/generic_hook.hpp
vendored
Normal file
@@ -0,0 +1,203 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2007-2009
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/intrusive for documentation.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_GENERIC_HOOK_HPP
|
||||
#define BOOST_INTRUSIVE_GENERIC_HOOK_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <boost/intrusive/intrusive_fwd.hpp>
|
||||
#include <boost/intrusive/detail/pointer_to_other.hpp>
|
||||
#include <boost/intrusive/link_mode.hpp>
|
||||
#include <boost/intrusive/detail/utilities.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
namespace detail {
|
||||
|
||||
/// @cond
|
||||
|
||||
enum
|
||||
{ NoBaseHook
|
||||
, ListBaseHook
|
||||
, SlistBaseHook
|
||||
, SetBaseHook
|
||||
, UsetBaseHook
|
||||
, SplaySetBaseHook
|
||||
, AvlSetBaseHook
|
||||
, BsSetBaseHook
|
||||
, AnyBaseHook
|
||||
};
|
||||
|
||||
struct no_default_definer{};
|
||||
|
||||
template <class Hook, unsigned int>
|
||||
struct default_definer;
|
||||
|
||||
template <class Hook>
|
||||
struct default_definer<Hook, ListBaseHook>
|
||||
{ typedef Hook default_list_hook; };
|
||||
|
||||
template <class Hook>
|
||||
struct default_definer<Hook, SlistBaseHook>
|
||||
{ typedef Hook default_slist_hook; };
|
||||
|
||||
template <class Hook>
|
||||
struct default_definer<Hook, SetBaseHook>
|
||||
{ typedef Hook default_set_hook; };
|
||||
|
||||
template <class Hook>
|
||||
struct default_definer<Hook, UsetBaseHook>
|
||||
{ typedef Hook default_uset_hook; };
|
||||
|
||||
template <class Hook>
|
||||
struct default_definer<Hook, SplaySetBaseHook>
|
||||
{ typedef Hook default_splay_set_hook; };
|
||||
|
||||
template <class Hook>
|
||||
struct default_definer<Hook, AvlSetBaseHook>
|
||||
{ typedef Hook default_avl_set_hook; };
|
||||
|
||||
template <class Hook>
|
||||
struct default_definer<Hook, BsSetBaseHook>
|
||||
{ typedef Hook default_bs_set_hook; };
|
||||
|
||||
template <class Hook>
|
||||
struct default_definer<Hook, AnyBaseHook>
|
||||
{ typedef Hook default_any_hook; };
|
||||
|
||||
template <class Hook, unsigned int BaseHookType>
|
||||
struct make_default_definer
|
||||
{
|
||||
typedef typename detail::if_c
|
||||
< BaseHookType != 0
|
||||
, default_definer<Hook, BaseHookType>
|
||||
, no_default_definer>::type type;
|
||||
};
|
||||
|
||||
template
|
||||
< class GetNodeAlgorithms
|
||||
, class Tag
|
||||
, link_mode_type LinkMode
|
||||
, int HookType
|
||||
>
|
||||
struct make_node_holder
|
||||
{
|
||||
typedef typename detail::if_c
|
||||
<!detail::is_same<Tag, member_tag>::value
|
||||
, detail::node_holder
|
||||
< typename GetNodeAlgorithms::type::node
|
||||
, Tag
|
||||
, LinkMode
|
||||
, HookType>
|
||||
, typename GetNodeAlgorithms::type::node
|
||||
>::type type;
|
||||
};
|
||||
|
||||
/// @endcond
|
||||
|
||||
template
|
||||
< class GetNodeAlgorithms
|
||||
, class Tag
|
||||
, link_mode_type LinkMode
|
||||
, int HookType
|
||||
>
|
||||
class generic_hook
|
||||
/// @cond
|
||||
|
||||
//If the hook is a base hook, derive generic hook from detail::node_holder
|
||||
//so that a unique base class is created to convert from the node
|
||||
//to the type. This mechanism will be used by base_hook_traits.
|
||||
//
|
||||
//If the hook is a member hook, generic hook will directly derive
|
||||
//from the hook.
|
||||
: public make_default_definer
|
||||
< generic_hook<GetNodeAlgorithms, Tag, LinkMode, HookType>
|
||||
, detail::is_same<Tag, default_tag>::value*HookType
|
||||
>::type
|
||||
, public make_node_holder<GetNodeAlgorithms, Tag, LinkMode, HookType>::type
|
||||
/// @endcond
|
||||
{
|
||||
/// @cond
|
||||
typedef typename GetNodeAlgorithms::type node_algorithms;
|
||||
typedef typename node_algorithms::node node;
|
||||
typedef typename node_algorithms::node_ptr node_ptr;
|
||||
typedef typename node_algorithms::const_node_ptr const_node_ptr;
|
||||
|
||||
public:
|
||||
struct boost_intrusive_tags
|
||||
{
|
||||
static const int hook_type = HookType;
|
||||
static const link_mode_type link_mode = LinkMode;
|
||||
typedef Tag tag;
|
||||
typedef typename GetNodeAlgorithms::type::node_traits node_traits;
|
||||
static const bool is_base_hook = !detail::is_same<Tag, member_tag>::value;
|
||||
static const bool safemode_or_autounlink =
|
||||
(int)link_mode == (int)auto_unlink || (int)link_mode == (int)safe_link;
|
||||
};
|
||||
|
||||
public:
|
||||
/// @endcond
|
||||
|
||||
generic_hook()
|
||||
{
|
||||
if(boost_intrusive_tags::safemode_or_autounlink){
|
||||
node_algorithms::init(static_cast<node*>(this));
|
||||
}
|
||||
}
|
||||
|
||||
generic_hook(const generic_hook& )
|
||||
{
|
||||
if(boost_intrusive_tags::safemode_or_autounlink){
|
||||
node_algorithms::init(static_cast<node*>(this));
|
||||
}
|
||||
}
|
||||
|
||||
generic_hook& operator=(const generic_hook& )
|
||||
{ return *this; }
|
||||
|
||||
~generic_hook()
|
||||
{
|
||||
destructor_impl
|
||||
(*this, detail::link_dispatch<boost_intrusive_tags::link_mode>());
|
||||
}
|
||||
|
||||
void swap_nodes(generic_hook &other)
|
||||
{
|
||||
node_algorithms::swap_nodes
|
||||
( static_cast<node*>(this), static_cast<node*>(&other));
|
||||
}
|
||||
|
||||
bool is_linked() const
|
||||
{
|
||||
//is_linked() can be only used in safe-mode or auto-unlink
|
||||
BOOST_STATIC_ASSERT(( boost_intrusive_tags::safemode_or_autounlink ));
|
||||
return !node_algorithms::unique
|
||||
(static_cast<const node*>(this));
|
||||
}
|
||||
|
||||
void unlink()
|
||||
{
|
||||
BOOST_STATIC_ASSERT(( (int)boost_intrusive_tags::link_mode == (int)auto_unlink ));
|
||||
node_algorithms::unlink(static_cast<node*>(this));
|
||||
node_algorithms::init(static_cast<node*>(this));
|
||||
}
|
||||
};
|
||||
|
||||
} //namespace detail
|
||||
} //namespace intrusive
|
||||
} //namespace boost
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
#endif //BOOST_INTRUSIVE_GENERIC_HOOK_HPP
|
||||
238
test/external/boost/intrusive/detail/hashtable_node.hpp
vendored
Normal file
238
test/external/boost/intrusive/detail/hashtable_node.hpp
vendored
Normal file
@@ -0,0 +1,238 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2007-2009
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/intrusive for documentation.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_HASHTABLE_NODE_HPP
|
||||
#define BOOST_INTRUSIVE_HASHTABLE_NODE_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <iterator>
|
||||
#include <boost/intrusive/detail/assert.hpp>
|
||||
#include <boost/intrusive/detail/pointer_to_other.hpp>
|
||||
#include <boost/intrusive/circular_list_algorithms.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/intrusive/detail/utilities.hpp>
|
||||
#include <boost/intrusive/detail/slist_node.hpp> //remove-me
|
||||
#include <cstddef>
|
||||
#include <boost/pointer_cast.hpp>
|
||||
#include <boost/move/move.hpp>
|
||||
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
namespace detail {
|
||||
|
||||
template<int Dummy = 0>
|
||||
struct prime_list_holder
|
||||
{
|
||||
static const std::size_t prime_list[];
|
||||
static const std::size_t prime_list_size;
|
||||
};
|
||||
|
||||
template<int Dummy>
|
||||
const std::size_t prime_list_holder<Dummy>::prime_list[] = {
|
||||
3ul, 7ul, 11ul, 17ul, 29ul,
|
||||
53ul, 97ul, 193ul, 389ul, 769ul,
|
||||
1543ul, 3079ul, 6151ul, 12289ul, 24593ul,
|
||||
49157ul, 98317ul, 196613ul, 393241ul, 786433ul,
|
||||
1572869ul, 3145739ul, 6291469ul, 12582917ul, 25165843ul,
|
||||
50331653ul, 100663319ul, 201326611ul, 402653189ul, 805306457ul,
|
||||
1610612741ul, 3221225473ul, 4294967291ul };
|
||||
|
||||
template<int Dummy>
|
||||
const std::size_t prime_list_holder<Dummy>::prime_list_size
|
||||
= sizeof(prime_list)/sizeof(std::size_t);
|
||||
|
||||
template <class Slist>
|
||||
struct bucket_impl : public Slist
|
||||
{
|
||||
typedef Slist slist_type;
|
||||
bucket_impl()
|
||||
{}
|
||||
|
||||
bucket_impl(const bucket_impl &)
|
||||
{}
|
||||
|
||||
~bucket_impl()
|
||||
{
|
||||
//This bucket is still being used!
|
||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(Slist::empty());
|
||||
}
|
||||
|
||||
bucket_impl &operator=(const bucket_impl&)
|
||||
{
|
||||
//This bucket is still in use!
|
||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(Slist::empty());
|
||||
//Slist::clear();
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
template<class Slist>
|
||||
struct bucket_traits_impl
|
||||
{
|
||||
private:
|
||||
BOOST_COPYABLE_AND_MOVABLE(bucket_traits_impl)
|
||||
|
||||
public:
|
||||
/// @cond
|
||||
typedef typename boost::pointer_to_other
|
||||
< typename Slist::pointer, bucket_impl<Slist> >::type bucket_ptr;
|
||||
typedef typename Slist::size_type size_type;
|
||||
/// @endcond
|
||||
|
||||
bucket_traits_impl(bucket_ptr buckets, size_type len)
|
||||
: buckets_(buckets), buckets_len_(len)
|
||||
{}
|
||||
|
||||
bucket_traits_impl(BOOST_RV_REF(bucket_traits_impl) x)
|
||||
: buckets_(x.buckets_), buckets_len_(x.buckets_len_)
|
||||
{ x.buckets_ = bucket_ptr(0); x.buckets_len_ = 0; }
|
||||
|
||||
bucket_traits_impl& operator=(BOOST_RV_REF(bucket_traits_impl) x)
|
||||
{
|
||||
buckets_ = x.buckets_; buckets_len_ = x.buckets_len_;
|
||||
x.buckets_ = bucket_ptr(0); x.buckets_len_ = 0; return *this;
|
||||
}
|
||||
|
||||
bucket_traits_impl& operator=(BOOST_COPY_ASSIGN_REF(bucket_traits_impl) x)
|
||||
{
|
||||
buckets_ = x.buckets_; buckets_len_ = x.buckets_len_; return *this;
|
||||
}
|
||||
|
||||
bucket_ptr bucket_begin() const
|
||||
{ return buckets_; }
|
||||
|
||||
size_type bucket_count() const
|
||||
{ return buckets_len_; }
|
||||
|
||||
private:
|
||||
bucket_ptr buckets_;
|
||||
size_type buckets_len_;
|
||||
};
|
||||
|
||||
template<class Container, bool IsConst>
|
||||
class hashtable_iterator
|
||||
: public std::iterator
|
||||
< std::forward_iterator_tag
|
||||
, typename Container::value_type
|
||||
, typename std::iterator_traits<typename Container::value_type*>::difference_type
|
||||
, typename detail::add_const_if_c
|
||||
<typename Container::value_type, IsConst>::type *
|
||||
, typename detail::add_const_if_c
|
||||
<typename Container::value_type, IsConst>::type &
|
||||
>
|
||||
{
|
||||
typedef typename Container::real_value_traits real_value_traits;
|
||||
typedef typename Container::siterator siterator;
|
||||
typedef typename Container::const_siterator const_siterator;
|
||||
typedef typename Container::bucket_type bucket_type;
|
||||
typedef typename boost::pointer_to_other
|
||||
< typename Container::pointer, const Container>::type const_cont_ptr;
|
||||
typedef typename Container::size_type size_type;
|
||||
|
||||
static typename Container::node_ptr downcast_bucket(typename bucket_type::node_ptr p)
|
||||
{
|
||||
// This still fails in gcc < 4.4 so forget about it
|
||||
// using ::boost::static_pointer_cast;
|
||||
// return static_pointer_cast<typename Container::node>(p);
|
||||
return typename Container::node_ptr(&static_cast<typename Container::node&>(*p));
|
||||
}
|
||||
|
||||
public:
|
||||
typedef typename Container::value_type value_type;
|
||||
typedef typename detail::add_const_if_c
|
||||
<typename Container::value_type, IsConst>::type *pointer;
|
||||
typedef typename detail::add_const_if_c
|
||||
<typename Container::value_type, IsConst>::type &reference;
|
||||
|
||||
hashtable_iterator ()
|
||||
{}
|
||||
|
||||
explicit hashtable_iterator(siterator ptr, const Container *cont)
|
||||
: slist_it_ (ptr), cont_ (cont)
|
||||
{}
|
||||
|
||||
hashtable_iterator(const hashtable_iterator<Container, false> &other)
|
||||
: slist_it_(other.slist_it()), cont_(other.get_container())
|
||||
{}
|
||||
|
||||
const siterator &slist_it() const
|
||||
{ return slist_it_; }
|
||||
|
||||
hashtable_iterator<Container, false> unconst() const
|
||||
{ return hashtable_iterator<Container, false>(this->slist_it(), this->get_container()); }
|
||||
|
||||
public:
|
||||
hashtable_iterator& operator++()
|
||||
{ this->increment(); return *this; }
|
||||
|
||||
hashtable_iterator operator++(int)
|
||||
{
|
||||
hashtable_iterator result (*this);
|
||||
this->increment();
|
||||
return result;
|
||||
}
|
||||
|
||||
friend bool operator== (const hashtable_iterator& i, const hashtable_iterator& i2)
|
||||
{ return i.slist_it_ == i2.slist_it_; }
|
||||
|
||||
friend bool operator!= (const hashtable_iterator& i, const hashtable_iterator& i2)
|
||||
{ return !(i == i2); }
|
||||
|
||||
reference operator*() const
|
||||
{ return *this->operator ->(); }
|
||||
|
||||
pointer operator->() const
|
||||
{ return detail::boost_intrusive_get_pointer(this->get_real_value_traits()->to_value_ptr(downcast_bucket(slist_it_.pointed_node()))); }
|
||||
|
||||
const Container *get_container() const
|
||||
{ return detail::boost_intrusive_get_pointer(cont_); }
|
||||
|
||||
const real_value_traits *get_real_value_traits() const
|
||||
{ return &this->get_container()->get_real_value_traits(); }
|
||||
|
||||
private:
|
||||
void increment()
|
||||
{
|
||||
const Container *cont = detail::boost_intrusive_get_pointer(cont_);
|
||||
bucket_type* buckets = detail::boost_intrusive_get_pointer(cont->bucket_pointer());
|
||||
size_type buckets_len = cont->bucket_count();
|
||||
|
||||
++slist_it_;
|
||||
if(buckets[0].cend().pointed_node() <= slist_it_.pointed_node() &&
|
||||
slist_it_.pointed_node()<= buckets[buckets_len].cend().pointed_node() ){
|
||||
//Now get the bucket_impl from the iterator
|
||||
const bucket_type &b = static_cast<const bucket_type&>
|
||||
(bucket_type::slist_type::container_from_end_iterator(slist_it_));
|
||||
|
||||
//Now just calculate the index b has in the bucket array
|
||||
size_type n_bucket = static_cast<size_type>(&b - &buckets[0]);
|
||||
do{
|
||||
if (++n_bucket == buckets_len){
|
||||
slist_it_ = (&buckets[0] + buckets_len)->end();
|
||||
break;
|
||||
}
|
||||
slist_it_ = buckets[n_bucket].begin();
|
||||
}
|
||||
while (slist_it_ == buckets[n_bucket].end());
|
||||
}
|
||||
}
|
||||
|
||||
siterator slist_it_;
|
||||
const_cont_ptr cont_;
|
||||
};
|
||||
|
||||
} //namespace detail {
|
||||
} //namespace intrusive {
|
||||
} //namespace boost {
|
||||
|
||||
#endif
|
||||
77
test/external/boost/intrusive/detail/is_stateful_value_traits.hpp
vendored
Normal file
77
test/external/boost/intrusive/detail/is_stateful_value_traits.hpp
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2009-2009.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/intrusive for documentation.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_DETAIL_IS_STATEFUL_VALUE_TRAITS_HPP
|
||||
#define BOOST_INTRUSIVE_DETAIL_IS_STATEFUL_VALUE_TRAITS_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER <= 1310)
|
||||
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
namespace detail {
|
||||
|
||||
template<class ValueTraits>
|
||||
struct is_stateful_value_traits
|
||||
{
|
||||
static const bool value = !detail::is_empty_class<ValueTraits>::value;
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
#else
|
||||
|
||||
#include <boost/intrusive/detail/function_detector.hpp>
|
||||
|
||||
BOOST_INTRUSIVE_CREATE_FUNCTION_DETECTOR(to_node_ptr, boost_intrusive)
|
||||
BOOST_INTRUSIVE_CREATE_FUNCTION_DETECTOR(to_value_ptr, boost_intrusive)
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
namespace detail {
|
||||
|
||||
template<class ValueTraits>
|
||||
struct is_stateful_value_traits
|
||||
{
|
||||
typedef typename ValueTraits::node_ptr node_ptr;
|
||||
typedef typename ValueTraits::pointer pointer;
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef typename ValueTraits::const_node_ptr const_node_ptr;
|
||||
typedef typename ValueTraits::const_pointer const_pointer;
|
||||
|
||||
typedef ValueTraits value_traits;
|
||||
|
||||
static const bool value =
|
||||
(boost::intrusive::function_detector::NonStaticFunction ==
|
||||
(BOOST_INTRUSIVE_DETECT_FUNCTION(ValueTraits, boost_intrusive, node_ptr, to_node_ptr, (value_type&) )))
|
||||
||
|
||||
(boost::intrusive::function_detector::NonStaticFunction ==
|
||||
(BOOST_INTRUSIVE_DETECT_FUNCTION(ValueTraits, boost_intrusive, pointer, to_value_ptr, (node_ptr) )))
|
||||
||
|
||||
(boost::intrusive::function_detector::NonStaticFunction ==
|
||||
(BOOST_INTRUSIVE_DETECT_FUNCTION(ValueTraits, boost_intrusive, const_node_ptr, to_node_ptr, (const value_type&) )))
|
||||
||
|
||||
(boost::intrusive::function_detector::NonStaticFunction ==
|
||||
(BOOST_INTRUSIVE_DETECT_FUNCTION(ValueTraits, boost_intrusive, const_pointer, to_value_ptr, (const_node_ptr) )))
|
||||
;
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
#endif //@ifndef BOOST_INTRUSIVE_DETAIL_IS_STATEFUL_VALUE_TRAITS_HPP
|
||||
188
test/external/boost/intrusive/detail/list_node.hpp
vendored
Normal file
188
test/external/boost/intrusive/detail/list_node.hpp
vendored
Normal file
@@ -0,0 +1,188 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2009
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/intrusive for documentation.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_LIST_NODE_HPP
|
||||
#define BOOST_INTRUSIVE_LIST_NODE_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <iterator>
|
||||
#include <boost/intrusive/detail/assert.hpp>
|
||||
#include <boost/intrusive/detail/pointer_to_other.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
||||
// list_node_traits can be used with circular_list_algorithms and supplies
|
||||
// a list_node holding the pointers needed for a double-linked list
|
||||
// it is used by list_derived_node and list_member_node
|
||||
|
||||
template<class VoidPointer>
|
||||
struct list_node
|
||||
{
|
||||
typedef typename boost::pointer_to_other
|
||||
<VoidPointer, list_node>::type node_ptr;
|
||||
node_ptr next_;
|
||||
node_ptr prev_;
|
||||
};
|
||||
|
||||
template<class VoidPointer>
|
||||
struct list_node_traits
|
||||
{
|
||||
typedef list_node<VoidPointer> node;
|
||||
typedef typename boost::pointer_to_other
|
||||
<VoidPointer, node>::type node_ptr;
|
||||
typedef typename boost::pointer_to_other
|
||||
<VoidPointer, const node>::type const_node_ptr;
|
||||
|
||||
static node_ptr get_previous(const_node_ptr n)
|
||||
{ return n->prev_; }
|
||||
|
||||
static void set_previous(node_ptr n, node_ptr prev)
|
||||
{ n->prev_ = prev; }
|
||||
|
||||
static node_ptr get_next(const_node_ptr n)
|
||||
{ return n->next_; }
|
||||
|
||||
static void set_next(node_ptr n, node_ptr next)
|
||||
{ n->next_ = next; }
|
||||
};
|
||||
|
||||
// list_iterator provides some basic functions for a
|
||||
// node oriented bidirectional iterator:
|
||||
template<class Container, bool IsConst>
|
||||
class list_iterator
|
||||
: public std::iterator
|
||||
< std::bidirectional_iterator_tag
|
||||
, typename Container::value_type
|
||||
, typename Container::difference_type
|
||||
, typename detail::if_c<IsConst,typename Container::const_pointer,typename Container::pointer>::type
|
||||
, typename detail::if_c<IsConst,typename Container::const_reference,typename Container::reference>::type
|
||||
>
|
||||
{
|
||||
protected:
|
||||
typedef typename Container::real_value_traits real_value_traits;
|
||||
typedef typename real_value_traits::node_traits node_traits;
|
||||
typedef typename node_traits::node node;
|
||||
typedef typename node_traits::node_ptr node_ptr;
|
||||
typedef typename boost::pointer_to_other
|
||||
<node_ptr, void>::type void_pointer;
|
||||
static const bool store_container_ptr =
|
||||
detail::store_cont_ptr_on_it<Container>::value;
|
||||
|
||||
public:
|
||||
typedef typename Container::value_type value_type;
|
||||
typedef typename detail::if_c<IsConst,typename Container::const_pointer,typename Container::pointer>::type pointer;
|
||||
typedef typename detail::if_c<IsConst,typename Container::const_reference,typename Container::reference>::type reference;
|
||||
|
||||
list_iterator()
|
||||
: members_ (node_ptr(0), 0)
|
||||
{}
|
||||
|
||||
explicit list_iterator(node_ptr node, const Container *cont_ptr)
|
||||
: members_ (node, cont_ptr)
|
||||
{}
|
||||
|
||||
list_iterator(list_iterator<Container, false> const& other)
|
||||
: members_(other.pointed_node(), other.get_container())
|
||||
{}
|
||||
|
||||
const node_ptr &pointed_node() const
|
||||
{ return members_.nodeptr_; }
|
||||
|
||||
list_iterator &operator=(const node_ptr &node)
|
||||
{ members_.nodeptr_ = node; return static_cast<list_iterator&>(*this); }
|
||||
|
||||
public:
|
||||
list_iterator& operator++()
|
||||
{
|
||||
members_.nodeptr_ = node_traits::get_next(members_.nodeptr_);
|
||||
return static_cast<list_iterator&> (*this);
|
||||
}
|
||||
|
||||
list_iterator operator++(int)
|
||||
{
|
||||
list_iterator result (*this);
|
||||
members_.nodeptr_ = node_traits::get_next(members_.nodeptr_);
|
||||
return result;
|
||||
}
|
||||
|
||||
list_iterator& operator--()
|
||||
{
|
||||
members_.nodeptr_ = node_traits::get_previous(members_.nodeptr_);
|
||||
return static_cast<list_iterator&> (*this);
|
||||
}
|
||||
|
||||
list_iterator operator--(int)
|
||||
{
|
||||
list_iterator result (*this);
|
||||
members_.nodeptr_ = node_traits::get_previous(members_.nodeptr_);
|
||||
return result;
|
||||
}
|
||||
|
||||
friend bool operator== (const list_iterator& l, const list_iterator& r)
|
||||
{ return l.pointed_node() == r.pointed_node(); }
|
||||
|
||||
friend bool operator!= (const list_iterator& l, const list_iterator& r)
|
||||
{ return !(l == r); }
|
||||
|
||||
reference operator*() const
|
||||
{ return *operator->(); }
|
||||
|
||||
pointer operator->() const
|
||||
{ return detail::boost_intrusive_get_pointer(this->get_real_value_traits()->to_value_ptr(members_.nodeptr_)); }
|
||||
|
||||
const Container *get_container() const
|
||||
{
|
||||
if(store_container_ptr){
|
||||
const Container* c = static_cast<const Container*>(members_.get_ptr());
|
||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(c != 0);
|
||||
return c;
|
||||
}
|
||||
else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
const real_value_traits *get_real_value_traits() const
|
||||
{
|
||||
if(store_container_ptr)
|
||||
return &this->get_container()->get_real_value_traits();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
list_iterator<Container, false> unconst() const
|
||||
{ return list_iterator<Container, false>(this->pointed_node(), this->get_container()); }
|
||||
|
||||
private:
|
||||
struct members
|
||||
: public detail::select_constptr
|
||||
<void_pointer, store_container_ptr>::type
|
||||
{
|
||||
typedef typename detail::select_constptr
|
||||
<void_pointer, store_container_ptr>::type Base;
|
||||
|
||||
members(const node_ptr &n_ptr, const void *cont)
|
||||
: Base(cont), nodeptr_(n_ptr)
|
||||
{}
|
||||
|
||||
node_ptr nodeptr_;
|
||||
} members_;
|
||||
};
|
||||
|
||||
} //namespace intrusive
|
||||
} //namespace boost
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
#endif //BOOST_INTRUSIVE_LIST_NODE_HPP
|
||||
355
test/external/boost/intrusive/detail/mpl.hpp
vendored
Normal file
355
test/external/boost/intrusive/detail/mpl.hpp
vendored
Normal file
@@ -0,0 +1,355 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2006-2009
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/intrusive for documentation.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_DETAIL_MPL_HPP
|
||||
#define BOOST_INTRUSIVE_DETAIL_MPL_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
namespace detail {
|
||||
|
||||
typedef char one;
|
||||
struct two {one _[2];};
|
||||
|
||||
template< bool C_ >
|
||||
struct bool_
|
||||
{
|
||||
static const bool value = C_;
|
||||
};
|
||||
|
||||
typedef bool_<true> true_;
|
||||
typedef bool_<false> false_;
|
||||
|
||||
typedef true_ true_type;
|
||||
typedef false_ false_type;
|
||||
|
||||
typedef char yes_type;
|
||||
struct no_type
|
||||
{
|
||||
char padding[8];
|
||||
};
|
||||
|
||||
template <bool B, class T = void>
|
||||
struct enable_if_c {
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct enable_if_c<false, T> {};
|
||||
|
||||
template <class Cond, class T = void>
|
||||
struct enable_if : public enable_if_c<Cond::value, T>{};
|
||||
|
||||
template<class F, class Param>
|
||||
struct apply
|
||||
{
|
||||
typedef typename F::template apply<Param>::type type;
|
||||
};
|
||||
|
||||
template <class T, class U>
|
||||
class is_convertible
|
||||
{
|
||||
typedef char true_t;
|
||||
class false_t { char dummy[2]; };
|
||||
static true_t dispatch(U);
|
||||
static false_t dispatch(...);
|
||||
static const T &trigger();
|
||||
public:
|
||||
static const bool value = sizeof(dispatch(trigger())) == sizeof(true_t);
|
||||
};
|
||||
|
||||
template<
|
||||
bool C
|
||||
, typename T1
|
||||
, typename T2
|
||||
>
|
||||
struct if_c
|
||||
{
|
||||
typedef T1 type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T1
|
||||
, typename T2
|
||||
>
|
||||
struct if_c<false,T1,T2>
|
||||
{
|
||||
typedef T2 type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename C
|
||||
, typename T1
|
||||
, typename T2
|
||||
>
|
||||
struct if_
|
||||
{
|
||||
typedef typename if_c<0 != C::value, T1, T2>::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
bool C
|
||||
, typename F1
|
||||
, typename F2
|
||||
>
|
||||
struct eval_if_c
|
||||
: if_c<C,F1,F2>::type
|
||||
{};
|
||||
|
||||
template<
|
||||
typename C
|
||||
, typename T1
|
||||
, typename T2
|
||||
>
|
||||
struct eval_if
|
||||
: if_<C,T1,T2>::type
|
||||
{};
|
||||
|
||||
// identity is an extension: it is not part of the standard.
|
||||
template <class T>
|
||||
struct identity
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
#if defined(BOOST_MSVC) || defined(__BORLANDC_)
|
||||
#define BOOST_INTRUSIVE_TT_DECL __cdecl
|
||||
#else
|
||||
#define BOOST_INTRUSIVE_TT_DECL
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_EXTENSIONS) && !defined(__BORLAND__) && !defined(_WIN64)
|
||||
#define BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
struct is_unary_or_binary_function_impl
|
||||
{ static const bool value = false; };
|
||||
|
||||
// see boost ticket #4094
|
||||
// avoid duplicate definitions of is_unary_or_binary_function_impl
|
||||
#ifndef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
|
||||
|
||||
template <typename R>
|
||||
struct is_unary_or_binary_function_impl<R (*)()>
|
||||
{ static const bool value = true; };
|
||||
|
||||
template <typename R>
|
||||
struct is_unary_or_binary_function_impl<R (*)(...)>
|
||||
{ static const bool value = true; };
|
||||
|
||||
#else // BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
|
||||
|
||||
template <typename R>
|
||||
struct is_unary_or_binary_function_impl<R (__stdcall*)()>
|
||||
{ static const bool value = true; };
|
||||
|
||||
template <typename R>
|
||||
struct is_unary_or_binary_function_impl<R (__fastcall*)()>
|
||||
{ static const bool value = true; };
|
||||
|
||||
template <typename R>
|
||||
struct is_unary_or_binary_function_impl<R (__cdecl*)()>
|
||||
{ static const bool value = true; };
|
||||
|
||||
template <typename R>
|
||||
struct is_unary_or_binary_function_impl<R (__cdecl*)(...)>
|
||||
{ static const bool value = true; };
|
||||
|
||||
#endif
|
||||
|
||||
// see boost ticket #4094
|
||||
// avoid duplicate definitions of is_unary_or_binary_function_impl
|
||||
#ifndef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
|
||||
|
||||
template <typename R, class T0>
|
||||
struct is_unary_or_binary_function_impl<R (*)(T0)>
|
||||
{ static const bool value = true; };
|
||||
|
||||
template <typename R, class T0>
|
||||
struct is_unary_or_binary_function_impl<R (*)(T0...)>
|
||||
{ static const bool value = true; };
|
||||
|
||||
#else // BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
|
||||
|
||||
template <typename R, class T0>
|
||||
struct is_unary_or_binary_function_impl<R (__stdcall*)(T0)>
|
||||
{ static const bool value = true; };
|
||||
|
||||
template <typename R, class T0>
|
||||
struct is_unary_or_binary_function_impl<R (__fastcall*)(T0)>
|
||||
{ static const bool value = true; };
|
||||
|
||||
template <typename R, class T0>
|
||||
struct is_unary_or_binary_function_impl<R (__cdecl*)(T0)>
|
||||
{ static const bool value = true; };
|
||||
|
||||
template <typename R, class T0>
|
||||
struct is_unary_or_binary_function_impl<R (__cdecl*)(T0...)>
|
||||
{ static const bool value = true; };
|
||||
|
||||
#endif
|
||||
|
||||
// see boost ticket #4094
|
||||
// avoid duplicate definitions of is_unary_or_binary_function_impl
|
||||
#ifndef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
|
||||
|
||||
template <typename R, class T0, class T1>
|
||||
struct is_unary_or_binary_function_impl<R (*)(T0, T1)>
|
||||
{ static const bool value = true; };
|
||||
|
||||
template <typename R, class T0, class T1>
|
||||
struct is_unary_or_binary_function_impl<R (*)(T0, T1...)>
|
||||
{ static const bool value = true; };
|
||||
|
||||
#else // BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
|
||||
|
||||
template <typename R, class T0, class T1>
|
||||
struct is_unary_or_binary_function_impl<R (__stdcall*)(T0, T1)>
|
||||
{ static const bool value = true; };
|
||||
|
||||
template <typename R, class T0, class T1>
|
||||
struct is_unary_or_binary_function_impl<R (__fastcall*)(T0, T1)>
|
||||
{ static const bool value = true; };
|
||||
|
||||
template <typename R, class T0, class T1>
|
||||
struct is_unary_or_binary_function_impl<R (__cdecl*)(T0, T1)>
|
||||
{ static const bool value = true; };
|
||||
|
||||
template <typename R, class T0, class T1>
|
||||
struct is_unary_or_binary_function_impl<R (__cdecl*)(T0, T1...)>
|
||||
{ static const bool value = true; };
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
struct is_unary_or_binary_function_impl<T&>
|
||||
{ static const bool value = false; };
|
||||
|
||||
template<typename T>
|
||||
struct is_unary_or_binary_function
|
||||
{ static const bool value = is_unary_or_binary_function_impl<T>::value; };
|
||||
|
||||
//boost::alignment_of yields to 10K lines of preprocessed code, so we
|
||||
//need an alternative
|
||||
template <typename T> struct alignment_of;
|
||||
|
||||
template <typename T>
|
||||
struct alignment_of_hack
|
||||
{
|
||||
char c;
|
||||
T t;
|
||||
alignment_of_hack();
|
||||
};
|
||||
|
||||
template <unsigned A, unsigned S>
|
||||
struct alignment_logic
|
||||
{
|
||||
static const std::size_t value = A < S ? A : S;
|
||||
};
|
||||
|
||||
template< typename T >
|
||||
struct alignment_of
|
||||
{
|
||||
static const std::size_t value = alignment_logic
|
||||
< sizeof(alignment_of_hack<T>) - sizeof(T)
|
||||
, sizeof(T)
|
||||
>::value;
|
||||
};
|
||||
|
||||
template <typename T, typename U>
|
||||
struct is_same
|
||||
{
|
||||
typedef char yes_type;
|
||||
struct no_type
|
||||
{
|
||||
char padding[8];
|
||||
};
|
||||
|
||||
template <typename V>
|
||||
static yes_type is_same_tester(V*, V*);
|
||||
static no_type is_same_tester(...);
|
||||
|
||||
static T *t;
|
||||
static U *u;
|
||||
|
||||
static const bool value = sizeof(yes_type) == sizeof(is_same_tester(t,u));
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct add_const
|
||||
{ typedef const T type; };
|
||||
|
||||
template<typename T>
|
||||
struct remove_const
|
||||
{ typedef T type; };
|
||||
|
||||
template<typename T>
|
||||
struct remove_const<const T>
|
||||
{ typedef T type; };
|
||||
|
||||
template<class T>
|
||||
struct remove_reference
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct remove_reference<T&>
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<class Class>
|
||||
class is_empty_class
|
||||
{
|
||||
template <typename T>
|
||||
struct empty_helper_t1 : public T
|
||||
{
|
||||
empty_helper_t1();
|
||||
int i[256];
|
||||
};
|
||||
|
||||
struct empty_helper_t2
|
||||
{ int i[256]; };
|
||||
|
||||
public:
|
||||
static const bool value = sizeof(empty_helper_t1<Class>) == sizeof(empty_helper_t2);
|
||||
};
|
||||
|
||||
template<std::size_t S>
|
||||
struct ls_zeros
|
||||
{
|
||||
static const std::size_t value = (S & std::size_t(1)) ? 0 : (1 + ls_zeros<(S>>1u)>::value);
|
||||
};
|
||||
|
||||
template<>
|
||||
struct ls_zeros<0>
|
||||
{
|
||||
static const std::size_t value = 0;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct ls_zeros<1>
|
||||
{
|
||||
static const std::size_t value = 0;
|
||||
};
|
||||
|
||||
} //namespace detail
|
||||
} //namespace intrusive
|
||||
} //namespace boost
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
#endif //BOOST_INTRUSIVE_DETAIL_MPL_HPP
|
||||
69
test/external/boost/intrusive/detail/parent_from_member.hpp
vendored
Normal file
69
test/external/boost/intrusive/detail/parent_from_member.hpp
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2007-2009
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/intrusive for documentation.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef BOOST_INTRUSIVE_DETAIL_PARENT_FROM_MEMBER_HPP
|
||||
#define BOOST_INTRUSIVE_DETAIL_PARENT_FROM_MEMBER_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
#if defined(BOOST_MSVC) || ((defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) && defined(BOOST_INTEL))
|
||||
|
||||
#define BOOST_INTRUSIVE_MSVC_COMPLIANT_PTR_TO_MEMBER
|
||||
#include <boost/cstdint.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
namespace detail {
|
||||
|
||||
template<class Parent, class Member>
|
||||
inline std::ptrdiff_t offset_from_pointer_to_member(const Member Parent::* ptr_to_member)
|
||||
{
|
||||
//The implementation of a pointer to member is compiler dependent.
|
||||
#if defined(BOOST_INTRUSIVE_MSVC_COMPLIANT_PTR_TO_MEMBER)
|
||||
//msvc compliant compilers use their the first 32 bits as offset (even in 64 bit mode)
|
||||
return *(const boost::int32_t*)(void*)&ptr_to_member;
|
||||
//This works with gcc, msvc, ac++, ibmcpp
|
||||
#elif defined(__GNUC__) || defined(__HP_aCC) || defined(BOOST_INTEL) || \
|
||||
defined(__IBMCPP__) || defined(__DECCXX)
|
||||
const Parent * const parent = 0;
|
||||
const char *const member = reinterpret_cast<const char*>(&(parent->*ptr_to_member));
|
||||
return std::ptrdiff_t(member - reinterpret_cast<const char*>(parent));
|
||||
#else
|
||||
//This is the traditional C-front approach: __MWERKS__, __DMC__, __SUNPRO_CC
|
||||
return (*(const std::ptrdiff_t*)(void*)&ptr_to_member) - 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
template<class Parent, class Member>
|
||||
inline Parent *parent_from_member(Member *member, const Member Parent::* ptr_to_member)
|
||||
{
|
||||
return (Parent*)((char*)member - offset_from_pointer_to_member(ptr_to_member));
|
||||
}
|
||||
|
||||
template<class Parent, class Member>
|
||||
inline const Parent *parent_from_member(const Member *member, const Member Parent::* ptr_to_member)
|
||||
{
|
||||
return (const Parent*)((const char*)member - offset_from_pointer_to_member(ptr_to_member));
|
||||
}
|
||||
|
||||
} //namespace detail {
|
||||
} //namespace intrusive {
|
||||
} //namespace boost {
|
||||
|
||||
#ifdef BOOST_INTRUSIVE_MSVC_COMPLIANT_PTR_TO_MEMBER
|
||||
#undef BOOST_INTRUSIVE_MSVC_COMPLIANT_PTR_TO_MEMBER
|
||||
#endif
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
#endif //#ifndef BOOST_INTRUSIVE_DETAIL_PARENT_FROM_MEMBER_HPP
|
||||
65
test/external/boost/intrusive/detail/pointer_to_other.hpp
vendored
Normal file
65
test/external/boost/intrusive/detail/pointer_to_other.hpp
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2006. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/intrusive for documentation.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_POINTER_TO_OTHER_HPP
|
||||
#define BOOST_INTRUSIVE_POINTER_TO_OTHER_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <boost/version.hpp>
|
||||
|
||||
#if (BOOST_VERSION < 103400)
|
||||
|
||||
#ifndef BOOST_POINTER_TO_OTHER_HPP_INCLUDED
|
||||
#define BOOST_POINTER_TO_OTHER_HPP_INCLUDED
|
||||
|
||||
namespace boost {
|
||||
|
||||
template<class T, class U>
|
||||
struct pointer_to_other;
|
||||
|
||||
template<class T, class U, template <class> class Sp>
|
||||
struct pointer_to_other< Sp<T>, U >
|
||||
{
|
||||
typedef Sp<U> type;
|
||||
};
|
||||
|
||||
template<class T, class T2, class U,
|
||||
template <class, class> class Sp>
|
||||
struct pointer_to_other< Sp<T, T2>, U >
|
||||
{
|
||||
typedef Sp<U, T2> type;
|
||||
};
|
||||
|
||||
template<class T, class T2, class T3, class U,
|
||||
template <class, class, class> class Sp>
|
||||
struct pointer_to_other< Sp<T, T2, T3>, U >
|
||||
{
|
||||
typedef Sp<U, T2, T3> type;
|
||||
};
|
||||
|
||||
template<class T, class U>
|
||||
struct pointer_to_other< T*, U >
|
||||
{
|
||||
typedef U* type;
|
||||
};
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#include <boost/pointer_to_other.hpp>
|
||||
|
||||
#endif //#ifndef BOOST_POINTER_TO_OTHER_HPP_INCLUDED
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
#endif //#ifndef BOOST_INTRUSIVE_POINTER_TO_OTHER_HPP
|
||||
177
test/external/boost/intrusive/detail/rbtree_node.hpp
vendored
Normal file
177
test/external/boost/intrusive/detail/rbtree_node.hpp
vendored
Normal file
@@ -0,0 +1,177 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2009.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/intrusive for documentation.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_RBTREE_NODE_HPP
|
||||
#define BOOST_INTRUSIVE_RBTREE_NODE_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <iterator>
|
||||
#include <boost/intrusive/detail/pointer_to_other.hpp>
|
||||
#include <boost/intrusive/rbtree_algorithms.hpp>
|
||||
#include <boost/intrusive/pointer_plus_bits.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// Generic node_traits for any pointer type //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//This is the compact representation: 3 pointers
|
||||
template<class VoidPointer>
|
||||
struct compact_rbtree_node
|
||||
{
|
||||
typedef typename pointer_to_other
|
||||
<VoidPointer
|
||||
,compact_rbtree_node<VoidPointer> >::type node_ptr;
|
||||
enum color { red_t, black_t };
|
||||
node_ptr parent_, left_, right_;
|
||||
};
|
||||
|
||||
//This is the normal representation: 3 pointers + enum
|
||||
template<class VoidPointer>
|
||||
struct rbtree_node
|
||||
{
|
||||
typedef typename pointer_to_other
|
||||
<VoidPointer
|
||||
,rbtree_node<VoidPointer> >::type node_ptr;
|
||||
|
||||
enum color { red_t, black_t };
|
||||
node_ptr parent_, left_, right_;
|
||||
color color_;
|
||||
};
|
||||
|
||||
//This is the default node traits implementation
|
||||
//using a node with 3 generic pointers plus an enum
|
||||
template<class VoidPointer>
|
||||
struct default_rbtree_node_traits_impl
|
||||
{
|
||||
typedef rbtree_node<VoidPointer> node;
|
||||
|
||||
typedef typename boost::pointer_to_other
|
||||
<VoidPointer, node>::type node_ptr;
|
||||
typedef typename boost::pointer_to_other
|
||||
<VoidPointer, const node>::type const_node_ptr;
|
||||
|
||||
typedef typename node::color color;
|
||||
|
||||
static node_ptr get_parent(const_node_ptr n)
|
||||
{ return n->parent_; }
|
||||
|
||||
static void set_parent(node_ptr n, node_ptr p)
|
||||
{ n->parent_ = p; }
|
||||
|
||||
static node_ptr get_left(const_node_ptr n)
|
||||
{ return n->left_; }
|
||||
|
||||
static void set_left(node_ptr n, node_ptr l)
|
||||
{ n->left_ = l; }
|
||||
|
||||
static node_ptr get_right(const_node_ptr n)
|
||||
{ return n->right_; }
|
||||
|
||||
static void set_right(node_ptr n, node_ptr r)
|
||||
{ n->right_ = r; }
|
||||
|
||||
static color get_color(const_node_ptr n)
|
||||
{ return n->color_; }
|
||||
|
||||
static void set_color(node_ptr n, color c)
|
||||
{ n->color_ = c; }
|
||||
|
||||
static color black()
|
||||
{ return node::black_t; }
|
||||
|
||||
static color red()
|
||||
{ return node::red_t; }
|
||||
};
|
||||
|
||||
//This is the compact node traits implementation
|
||||
//using a node with 3 generic pointers
|
||||
template<class VoidPointer>
|
||||
struct compact_rbtree_node_traits_impl
|
||||
{
|
||||
typedef compact_rbtree_node<VoidPointer> node;
|
||||
typedef typename boost::pointer_to_other
|
||||
<VoidPointer, node>::type node_ptr;
|
||||
typedef typename boost::pointer_to_other
|
||||
<VoidPointer, const node>::type const_node_ptr;
|
||||
|
||||
typedef pointer_plus_bits<node_ptr, 1> ptr_bit;
|
||||
|
||||
typedef typename node::color color;
|
||||
|
||||
static node_ptr get_parent(const_node_ptr n)
|
||||
{ return ptr_bit::get_pointer(n->parent_); }
|
||||
|
||||
static void set_parent(node_ptr n, node_ptr p)
|
||||
{ ptr_bit::set_pointer(n->parent_, p); }
|
||||
|
||||
static node_ptr get_left(const_node_ptr n)
|
||||
{ return n->left_; }
|
||||
|
||||
static void set_left(node_ptr n, node_ptr l)
|
||||
{ n->left_ = l; }
|
||||
|
||||
static node_ptr get_right(const_node_ptr n)
|
||||
{ return n->right_; }
|
||||
|
||||
static void set_right(node_ptr n, node_ptr r)
|
||||
{ n->right_ = r; }
|
||||
|
||||
static color get_color(const_node_ptr n)
|
||||
{ return (color)ptr_bit::get_bits(n->parent_); }
|
||||
|
||||
static void set_color(node_ptr n, color c)
|
||||
{ ptr_bit::set_bits(n->parent_, c != 0); }
|
||||
|
||||
static color black()
|
||||
{ return node::black_t; }
|
||||
|
||||
static color red()
|
||||
{ return node::red_t; }
|
||||
};
|
||||
|
||||
//Dispatches the implementation based on the boolean
|
||||
template<class VoidPointer, bool Compact>
|
||||
struct rbtree_node_traits_dispatch
|
||||
: public default_rbtree_node_traits_impl<VoidPointer>
|
||||
{};
|
||||
|
||||
template<class VoidPointer>
|
||||
struct rbtree_node_traits_dispatch<VoidPointer, true>
|
||||
: public compact_rbtree_node_traits_impl<VoidPointer>
|
||||
{};
|
||||
|
||||
//Inherit from the detail::link_dispatch depending on the embedding capabilities
|
||||
template<class VoidPointer, bool OptimizeSize = false>
|
||||
struct rbtree_node_traits
|
||||
: public rbtree_node_traits_dispatch
|
||||
< VoidPointer
|
||||
, OptimizeSize &&
|
||||
(max_pointer_plus_bits
|
||||
< VoidPointer
|
||||
, detail::alignment_of<compact_rbtree_node<VoidPointer> >::value
|
||||
>::value >= 1)
|
||||
>
|
||||
{};
|
||||
|
||||
} //namespace intrusive
|
||||
} //namespace boost
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
#endif //BOOST_INTRUSIVE_RBTREE_NODE_HPP
|
||||
163
test/external/boost/intrusive/detail/slist_node.hpp
vendored
Normal file
163
test/external/boost/intrusive/detail/slist_node.hpp
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2009
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/intrusive for documentation.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_SLIST_NODE_HPP
|
||||
#define BOOST_INTRUSIVE_SLIST_NODE_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <iterator>
|
||||
#include <boost/intrusive/detail/assert.hpp>
|
||||
#include <boost/intrusive/detail/pointer_to_other.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
||||
template<class VoidPointer>
|
||||
struct slist_node
|
||||
{
|
||||
typedef typename boost::pointer_to_other
|
||||
<VoidPointer, slist_node>::type node_ptr;
|
||||
node_ptr next_;
|
||||
};
|
||||
|
||||
// slist_node_traits can be used with circular_slist_algorithms and supplies
|
||||
// a slist_node holding the pointers needed for a singly-linked list
|
||||
// it is used by slist_base_hook and slist_member_hook
|
||||
template<class VoidPointer>
|
||||
struct slist_node_traits
|
||||
{
|
||||
typedef slist_node<VoidPointer> node;
|
||||
typedef typename boost::pointer_to_other
|
||||
<VoidPointer, node>::type node_ptr;
|
||||
typedef typename boost::pointer_to_other
|
||||
<VoidPointer, const node>::type const_node_ptr;
|
||||
|
||||
static node_ptr get_next(const_node_ptr n)
|
||||
{ return n->next_; }
|
||||
|
||||
static void set_next(node_ptr n, node_ptr next)
|
||||
{ n->next_ = next; }
|
||||
};
|
||||
|
||||
// slist_iterator provides some basic functions for a
|
||||
// node oriented bidirectional iterator:
|
||||
template<class Container, bool IsConst>
|
||||
class slist_iterator
|
||||
: public std::iterator
|
||||
< std::forward_iterator_tag
|
||||
, typename Container::value_type
|
||||
, typename Container::difference_type
|
||||
, typename detail::if_c<IsConst,typename Container::const_pointer,typename Container::pointer>::type
|
||||
, typename detail::if_c<IsConst,typename Container::const_reference,typename Container::reference>::type
|
||||
>
|
||||
{
|
||||
protected:
|
||||
typedef typename Container::real_value_traits real_value_traits;
|
||||
typedef typename real_value_traits::node_traits node_traits;
|
||||
typedef typename node_traits::node node;
|
||||
typedef typename node_traits::node_ptr node_ptr;
|
||||
typedef typename boost::pointer_to_other
|
||||
<node_ptr, void>::type void_pointer;
|
||||
static const bool store_container_ptr =
|
||||
detail::store_cont_ptr_on_it<Container>::value;
|
||||
|
||||
public:
|
||||
typedef typename Container::value_type value_type;
|
||||
typedef typename detail::if_c<IsConst,typename Container::const_pointer,typename Container::pointer>::type pointer;
|
||||
typedef typename detail::if_c<IsConst,typename Container::const_reference,typename Container::reference>::type reference;
|
||||
|
||||
slist_iterator()
|
||||
: members_ (node_ptr(0), 0)
|
||||
{}
|
||||
|
||||
explicit slist_iterator(node_ptr node, const Container *cont_ptr)
|
||||
: members_ (node, cont_ptr)
|
||||
{}
|
||||
|
||||
slist_iterator(slist_iterator<Container, false> const& other)
|
||||
: members_(other.pointed_node(), other.get_container())
|
||||
{}
|
||||
|
||||
const node_ptr &pointed_node() const
|
||||
{ return members_.nodeptr_; }
|
||||
|
||||
slist_iterator &operator=(const node_ptr &node)
|
||||
{ members_.nodeptr_ = node; return static_cast<slist_iterator&>(*this); }
|
||||
|
||||
public:
|
||||
slist_iterator& operator++()
|
||||
{
|
||||
members_.nodeptr_ = node_traits::get_next(members_.nodeptr_);
|
||||
return static_cast<slist_iterator&> (*this);
|
||||
}
|
||||
|
||||
slist_iterator operator++(int)
|
||||
{
|
||||
slist_iterator result (*this);
|
||||
members_.nodeptr_ = node_traits::get_next(members_.nodeptr_);
|
||||
return result;
|
||||
}
|
||||
|
||||
friend bool operator== (const slist_iterator& l, const slist_iterator& r)
|
||||
{ return l.pointed_node() == r.pointed_node(); }
|
||||
|
||||
friend bool operator!= (const slist_iterator& l, const slist_iterator& r)
|
||||
{ return !(l == r); }
|
||||
|
||||
reference operator*() const
|
||||
{ return *operator->(); }
|
||||
|
||||
pointer operator->() const
|
||||
{ return detail::boost_intrusive_get_pointer(this->get_real_value_traits()->to_value_ptr(members_.nodeptr_)); }
|
||||
|
||||
const Container *get_container() const
|
||||
{
|
||||
if(store_container_ptr)
|
||||
return static_cast<const Container*>(members_.get_ptr());
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
slist_iterator<Container, false> unconst() const
|
||||
{ return slist_iterator<Container, false>(this->pointed_node(), this->get_container()); }
|
||||
|
||||
const real_value_traits *get_real_value_traits() const
|
||||
{
|
||||
if(store_container_ptr)
|
||||
return &this->get_container()->get_real_value_traits();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
private:
|
||||
struct members
|
||||
: public detail::select_constptr
|
||||
<void_pointer, store_container_ptr>::type
|
||||
{
|
||||
typedef typename detail::select_constptr
|
||||
<void_pointer, store_container_ptr>::type Base;
|
||||
|
||||
members(const node_ptr &n_ptr, const void *cont)
|
||||
: Base(cont), nodeptr_(n_ptr)
|
||||
{}
|
||||
|
||||
node_ptr nodeptr_;
|
||||
} members_;
|
||||
};
|
||||
|
||||
} //namespace intrusive
|
||||
} //namespace boost
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
#endif //BOOST_INTRUSIVE_SLIST_NODE_HPP
|
||||
173
test/external/boost/intrusive/detail/transform_iterator.hpp
vendored
Normal file
173
test/external/boost/intrusive/detail/transform_iterator.hpp
vendored
Normal file
@@ -0,0 +1,173 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2007-2009
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/intrusive for documentation.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_DETAIL_TRANSFORM_ITERATOR_HPP
|
||||
#define BOOST_INTRUSIVE_DETAIL_TRANSFORM_ITERATOR_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <iterator>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
namespace detail {
|
||||
|
||||
template <class PseudoReference>
|
||||
struct operator_arrow_proxy
|
||||
{
|
||||
operator_arrow_proxy(const PseudoReference &px)
|
||||
: m_value(px)
|
||||
{}
|
||||
|
||||
PseudoReference* operator->() const { return &m_value; }
|
||||
// This function is needed for MWCW and BCC, which won't call operator->
|
||||
// again automatically per 13.3.1.2 para 8
|
||||
// operator T*() const { return &m_value; }
|
||||
mutable PseudoReference m_value;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct operator_arrow_proxy<T&>
|
||||
{
|
||||
operator_arrow_proxy(T &px)
|
||||
: m_value(px)
|
||||
{}
|
||||
|
||||
T* operator->() const { return &m_value; }
|
||||
// This function is needed for MWCW and BCC, which won't call operator->
|
||||
// again automatically per 13.3.1.2 para 8
|
||||
// operator T*() const { return &m_value; }
|
||||
T &m_value;
|
||||
};
|
||||
|
||||
template <class Iterator, class UnaryFunction>
|
||||
class transform_iterator
|
||||
: public std::iterator
|
||||
< typename Iterator::iterator_category
|
||||
, typename detail::remove_reference<typename UnaryFunction::result_type>::type
|
||||
, typename Iterator::difference_type
|
||||
, operator_arrow_proxy<typename UnaryFunction::result_type>
|
||||
, typename UnaryFunction::result_type>
|
||||
{
|
||||
public:
|
||||
explicit transform_iterator(const Iterator &it, const UnaryFunction &f = UnaryFunction())
|
||||
: members_(it, f)
|
||||
{}
|
||||
|
||||
explicit transform_iterator()
|
||||
: members_()
|
||||
{}
|
||||
|
||||
Iterator get_it() const
|
||||
{ return members_.m_it; }
|
||||
|
||||
//Constructors
|
||||
transform_iterator& operator++()
|
||||
{ increment(); return *this; }
|
||||
|
||||
transform_iterator operator++(int)
|
||||
{
|
||||
transform_iterator result (*this);
|
||||
increment();
|
||||
return result;
|
||||
}
|
||||
|
||||
friend bool operator== (const transform_iterator& i, const transform_iterator& i2)
|
||||
{ return i.equal(i2); }
|
||||
|
||||
friend bool operator!= (const transform_iterator& i, const transform_iterator& i2)
|
||||
{ return !(i == i2); }
|
||||
|
||||
/*
|
||||
friend bool operator> (const transform_iterator& i, const transform_iterator& i2)
|
||||
{ return i2 < i; }
|
||||
|
||||
friend bool operator<= (const transform_iterator& i, const transform_iterator& i2)
|
||||
{ return !(i > i2); }
|
||||
|
||||
friend bool operator>= (const transform_iterator& i, const transform_iterator& i2)
|
||||
{ return !(i < i2); }
|
||||
*/
|
||||
friend typename Iterator::difference_type operator- (const transform_iterator& i, const transform_iterator& i2)
|
||||
{ return i2.distance_to(i); }
|
||||
|
||||
//Arithmetic
|
||||
transform_iterator& operator+=(typename Iterator::difference_type off)
|
||||
{ this->advance(off); return *this; }
|
||||
|
||||
transform_iterator operator+(typename Iterator::difference_type off) const
|
||||
{
|
||||
transform_iterator other(*this);
|
||||
other.advance(off);
|
||||
return other;
|
||||
}
|
||||
|
||||
friend transform_iterator operator+(typename Iterator::difference_type off, const transform_iterator& right)
|
||||
{ return right + off; }
|
||||
|
||||
transform_iterator& operator-=(typename Iterator::difference_type off)
|
||||
{ this->advance(-off); return *this; }
|
||||
|
||||
transform_iterator operator-(typename Iterator::difference_type off) const
|
||||
{ return *this + (-off); }
|
||||
|
||||
typename UnaryFunction::result_type operator*() const
|
||||
{ return dereference(); }
|
||||
|
||||
operator_arrow_proxy<typename UnaryFunction::result_type>
|
||||
operator->() const
|
||||
{ return operator_arrow_proxy<typename UnaryFunction::result_type>(dereference()); }
|
||||
|
||||
private:
|
||||
struct members
|
||||
: UnaryFunction
|
||||
{
|
||||
members(const Iterator &it, const UnaryFunction &f)
|
||||
: UnaryFunction(f), m_it(it)
|
||||
{}
|
||||
|
||||
members()
|
||||
{}
|
||||
|
||||
Iterator m_it;
|
||||
} members_;
|
||||
|
||||
|
||||
void increment()
|
||||
{ ++members_.m_it; }
|
||||
|
||||
void decrement()
|
||||
{ --members_.m_it; }
|
||||
|
||||
bool equal(const transform_iterator &other) const
|
||||
{ return members_.m_it == other.members_.m_it; }
|
||||
|
||||
bool less(const transform_iterator &other) const
|
||||
{ return other.members_.m_it < members_.m_it; }
|
||||
|
||||
typename UnaryFunction::result_type dereference() const
|
||||
{ return members_(*members_.m_it); }
|
||||
|
||||
void advance(typename Iterator::difference_type n)
|
||||
{ std::advance(members_.m_it, n); }
|
||||
|
||||
typename Iterator::difference_type distance_to(const transform_iterator &other)const
|
||||
{ return std::distance(other.members_.m_it, members_.m_it); }
|
||||
};
|
||||
|
||||
} //namespace detail
|
||||
} //namespace intrusive
|
||||
} //namespace boost
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
#endif //BOOST_INTRUSIVE_DETAIL_TRANSFORM_ITERATOR_HPP
|
||||
1693
test/external/boost/intrusive/detail/tree_algorithms.hpp
vendored
Normal file
1693
test/external/boost/intrusive/detail/tree_algorithms.hpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
190
test/external/boost/intrusive/detail/tree_node.hpp
vendored
Normal file
190
test/external/boost/intrusive/detail/tree_node.hpp
vendored
Normal file
@@ -0,0 +1,190 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 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)
|
||||
//
|
||||
// See http://www.boost.org/libs/intrusive for documentation.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_TREE_NODE_HPP
|
||||
#define BOOST_INTRUSIVE_TREE_NODE_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <iterator>
|
||||
#include <boost/intrusive/detail/pointer_to_other.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
||||
template<class VoidPointer>
|
||||
struct tree_node
|
||||
{
|
||||
typedef typename pointer_to_other
|
||||
<VoidPointer
|
||||
,tree_node<VoidPointer> >::type node_ptr;
|
||||
|
||||
node_ptr parent_, left_, right_;
|
||||
};
|
||||
|
||||
template<class VoidPointer>
|
||||
struct tree_node_traits
|
||||
{
|
||||
typedef tree_node<VoidPointer> node;
|
||||
|
||||
typedef typename boost::pointer_to_other
|
||||
<VoidPointer, node>::type node_ptr;
|
||||
typedef typename boost::pointer_to_other
|
||||
<VoidPointer, const node>::type const_node_ptr;
|
||||
|
||||
static node_ptr get_parent(const_node_ptr n)
|
||||
{ return n->parent_; }
|
||||
|
||||
static void set_parent(node_ptr n, node_ptr p)
|
||||
{ n->parent_ = p; }
|
||||
|
||||
static node_ptr get_left(const_node_ptr n)
|
||||
{ return n->left_; }
|
||||
|
||||
static void set_left(node_ptr n, node_ptr l)
|
||||
{ n->left_ = l; }
|
||||
|
||||
static node_ptr get_right(const_node_ptr n)
|
||||
{ return n->right_; }
|
||||
|
||||
static void set_right(node_ptr n, node_ptr r)
|
||||
{ n->right_ = r; }
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// Implementation of the tree iterator //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// tree_iterator provides some basic functions for a
|
||||
// node oriented bidirectional iterator:
|
||||
template<class Container, bool IsConst>
|
||||
class tree_iterator
|
||||
: public std::iterator
|
||||
< std::bidirectional_iterator_tag
|
||||
, typename Container::value_type
|
||||
, typename Container::difference_type
|
||||
, typename detail::if_c<IsConst,typename Container::const_pointer,typename Container::pointer>::type
|
||||
, typename detail::if_c<IsConst,typename Container::const_reference,typename Container::reference>::type
|
||||
>
|
||||
{
|
||||
protected:
|
||||
typedef typename Container::real_value_traits real_value_traits;
|
||||
typedef typename Container::node_algorithms node_algorithms;
|
||||
typedef typename real_value_traits::node_traits node_traits;
|
||||
typedef typename node_traits::node node;
|
||||
typedef typename node_traits::node_ptr node_ptr;
|
||||
typedef typename boost::pointer_to_other
|
||||
<node_ptr, void>::type void_pointer;
|
||||
static const bool store_container_ptr =
|
||||
detail::store_cont_ptr_on_it<Container>::value;
|
||||
|
||||
public:
|
||||
typedef typename Container::value_type value_type;
|
||||
typedef typename detail::if_c<IsConst,typename Container::const_pointer,typename Container::pointer>::type pointer;
|
||||
typedef typename detail::if_c<IsConst,typename Container::const_reference,typename Container::reference>::type reference;
|
||||
|
||||
|
||||
tree_iterator()
|
||||
: members_ (node_ptr(0), (const void *)0)
|
||||
{}
|
||||
|
||||
explicit tree_iterator(node_ptr nodeptr, const Container *cont_ptr)
|
||||
: members_ (nodeptr, cont_ptr)
|
||||
{}
|
||||
|
||||
tree_iterator(tree_iterator<Container, false> const& other)
|
||||
: members_(other.pointed_node(), other.get_container())
|
||||
{}
|
||||
|
||||
const node_ptr &pointed_node() const
|
||||
{ return members_.nodeptr_; }
|
||||
|
||||
tree_iterator &operator=(const node_ptr &nodeptr)
|
||||
{ members_.nodeptr_ = nodeptr; return static_cast<tree_iterator&>(*this); }
|
||||
|
||||
public:
|
||||
tree_iterator& operator++()
|
||||
{
|
||||
members_.nodeptr_ = node_algorithms::next_node(members_.nodeptr_);
|
||||
return static_cast<tree_iterator&> (*this);
|
||||
}
|
||||
|
||||
tree_iterator operator++(int)
|
||||
{
|
||||
tree_iterator result (*this);
|
||||
members_.nodeptr_ = node_algorithms::next_node(members_.nodeptr_);
|
||||
return result;
|
||||
}
|
||||
|
||||
tree_iterator& operator--()
|
||||
{
|
||||
members_.nodeptr_ = node_algorithms::prev_node(members_.nodeptr_);
|
||||
return static_cast<tree_iterator&> (*this);
|
||||
}
|
||||
|
||||
tree_iterator operator--(int)
|
||||
{
|
||||
tree_iterator result (*this);
|
||||
members_.nodeptr_ = node_algorithms::prev_node(members_.nodeptr_);
|
||||
return result;
|
||||
}
|
||||
|
||||
friend bool operator== (const tree_iterator& l, const tree_iterator& r)
|
||||
{ return l.pointed_node() == r.pointed_node(); }
|
||||
|
||||
friend bool operator!= (const tree_iterator& l, const tree_iterator& r)
|
||||
{ return !(l == r); }
|
||||
|
||||
reference operator*() const
|
||||
{ return *operator->(); }
|
||||
|
||||
pointer operator->() const
|
||||
{ return detail::boost_intrusive_get_pointer(this->get_real_value_traits()->to_value_ptr(members_.nodeptr_)); }
|
||||
|
||||
const Container *get_container() const
|
||||
{ return static_cast<const Container*>(members_.get_ptr()); }
|
||||
|
||||
const real_value_traits *get_real_value_traits() const
|
||||
{ return &this->get_container()->get_real_value_traits(); }
|
||||
|
||||
tree_iterator end_iterator_from_it() const
|
||||
{
|
||||
return tree_iterator(node_algorithms::get_header(this->pointed_node()), this->get_container());
|
||||
}
|
||||
|
||||
tree_iterator<Container, false> unconst() const
|
||||
{ return tree_iterator<Container, false>(this->pointed_node(), this->get_container()); }
|
||||
|
||||
private:
|
||||
struct members
|
||||
: public detail::select_constptr
|
||||
<void_pointer, store_container_ptr>::type
|
||||
{
|
||||
typedef typename detail::select_constptr
|
||||
<void_pointer, store_container_ptr>::type Base;
|
||||
|
||||
members(const node_ptr &n_ptr, const void *cont)
|
||||
: Base(cont), nodeptr_(n_ptr)
|
||||
{}
|
||||
|
||||
node_ptr nodeptr_;
|
||||
} members_;
|
||||
};
|
||||
|
||||
} //namespace intrusive
|
||||
} //namespace boost
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
#endif //BOOST_INTRUSIVE_TREE_NODE_HPP
|
||||
741
test/external/boost/intrusive/detail/utilities.hpp
vendored
Normal file
741
test/external/boost/intrusive/detail/utilities.hpp
vendored
Normal file
@@ -0,0 +1,741 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2006-2009
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/intrusive for documentation.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_DETAIL_UTILITIES_HPP
|
||||
#define BOOST_INTRUSIVE_DETAIL_UTILITIES_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <boost/intrusive/detail/pointer_to_other.hpp>
|
||||
#include <boost/intrusive/detail/parent_from_member.hpp>
|
||||
#include <boost/intrusive/detail/ebo_functor_holder.hpp>
|
||||
#include <boost/intrusive/link_mode.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/intrusive/detail/assert.hpp>
|
||||
#include <boost/intrusive/detail/is_stateful_value_traits.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <cstddef>
|
||||
#include <climits>
|
||||
#include <iterator>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
namespace detail {
|
||||
|
||||
template <class T>
|
||||
struct internal_member_value_traits
|
||||
{
|
||||
template <class U> static detail::one test(...);
|
||||
template <class U> static detail::two test(typename U::member_value_traits* = 0);
|
||||
static const bool value = sizeof(test<T>(0)) == sizeof(detail::two);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct internal_base_hook_bool
|
||||
{
|
||||
template<bool Add>
|
||||
struct two_or_three {one _[2 + Add];};
|
||||
template <class U> static one test(...);
|
||||
template <class U> static two_or_three<U::boost_intrusive_tags::is_base_hook> test (int);
|
||||
static const std::size_t value = sizeof(test<T>(0));
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct internal_base_hook_bool_is_true
|
||||
{
|
||||
static const bool value = internal_base_hook_bool<T>::value > sizeof(one)*2;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct internal_any_hook_bool
|
||||
{
|
||||
template<bool Add>
|
||||
struct two_or_three {one _[2 + Add];};
|
||||
template <class U> static one test(...);
|
||||
template <class U> static two_or_three<U::is_any_hook> test (int);
|
||||
static const std::size_t value = sizeof(test<T>(0));
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct internal_any_hook_bool_is_true
|
||||
{
|
||||
static const bool value = internal_any_hook_bool<T>::value > sizeof(one)*2;
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
struct external_value_traits_bool
|
||||
{
|
||||
template<bool Add>
|
||||
struct two_or_three {one _[2 + Add];};
|
||||
template <class U> static one test(...);
|
||||
template <class U> static two_or_three<U::external_value_traits> test (int);
|
||||
static const std::size_t value = sizeof(test<T>(0));
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct external_bucket_traits_bool
|
||||
{
|
||||
template<bool Add>
|
||||
struct two_or_three {one _[2 + Add];};
|
||||
template <class U> static one test(...);
|
||||
template <class U> static two_or_three<U::external_bucket_traits> test (int);
|
||||
static const std::size_t value = sizeof(test<T>(0));
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct external_value_traits_is_true
|
||||
{
|
||||
static const bool value = external_value_traits_bool<T>::value > sizeof(one)*2;
|
||||
};
|
||||
|
||||
template<class Node, class Tag, link_mode_type LinkMode, int>
|
||||
struct node_holder
|
||||
: public Node
|
||||
{};
|
||||
|
||||
template<class SmartPtr>
|
||||
struct smart_ptr_type
|
||||
{
|
||||
typedef typename SmartPtr::value_type value_type;
|
||||
typedef value_type *pointer;
|
||||
static pointer get (const SmartPtr &smartptr)
|
||||
{ return smartptr.get();}
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct smart_ptr_type<T*>
|
||||
{
|
||||
typedef T value_type;
|
||||
typedef value_type *pointer;
|
||||
static pointer get (pointer ptr)
|
||||
{ return ptr;}
|
||||
};
|
||||
|
||||
//!Overload for smart pointers to avoid ADL problems with boost_intrusive_get_pointer
|
||||
template<class Ptr>
|
||||
inline typename smart_ptr_type<Ptr>::pointer
|
||||
boost_intrusive_get_pointer(const Ptr &ptr)
|
||||
{ return smart_ptr_type<Ptr>::get(ptr); }
|
||||
|
||||
//This functor compares a stored value
|
||||
//and the one passed as an argument
|
||||
template<class ConstReference>
|
||||
class equal_to_value
|
||||
{
|
||||
ConstReference t_;
|
||||
|
||||
public:
|
||||
equal_to_value(ConstReference t)
|
||||
: t_(t)
|
||||
{}
|
||||
|
||||
bool operator()(ConstReference t)const
|
||||
{ return t_ == t; }
|
||||
};
|
||||
|
||||
class null_disposer
|
||||
{
|
||||
public:
|
||||
template <class Pointer>
|
||||
void operator()(Pointer)
|
||||
{}
|
||||
};
|
||||
|
||||
template<class NodeAlgorithms>
|
||||
class init_disposer
|
||||
{
|
||||
typedef typename NodeAlgorithms::node_ptr node_ptr;
|
||||
|
||||
public:
|
||||
void operator()(node_ptr p)
|
||||
{ NodeAlgorithms::init(p); }
|
||||
};
|
||||
|
||||
template<bool ConstantSize, class SizeType>
|
||||
struct size_holder
|
||||
{
|
||||
static const bool constant_time_size = ConstantSize;
|
||||
typedef SizeType size_type;
|
||||
|
||||
SizeType get_size() const
|
||||
{ return size_; }
|
||||
|
||||
void set_size(SizeType size)
|
||||
{ size_ = size; }
|
||||
|
||||
void decrement()
|
||||
{ --size_; }
|
||||
|
||||
void increment()
|
||||
{ ++size_; }
|
||||
|
||||
SizeType size_;
|
||||
};
|
||||
|
||||
template<class SizeType>
|
||||
struct size_holder<false, SizeType>
|
||||
{
|
||||
static const bool constant_time_size = false;
|
||||
typedef SizeType size_type;
|
||||
|
||||
size_type get_size() const
|
||||
{ return 0; }
|
||||
|
||||
void set_size(size_type)
|
||||
{}
|
||||
|
||||
void decrement()
|
||||
{}
|
||||
|
||||
void increment()
|
||||
{}
|
||||
};
|
||||
|
||||
template<class KeyValueCompare, class Container>
|
||||
struct key_nodeptr_comp
|
||||
: private detail::ebo_functor_holder<KeyValueCompare>
|
||||
{
|
||||
typedef typename Container::real_value_traits real_value_traits;
|
||||
typedef typename Container::value_type value_type;
|
||||
typedef typename real_value_traits::node_ptr node_ptr;
|
||||
typedef typename real_value_traits::const_node_ptr const_node_ptr;
|
||||
typedef detail::ebo_functor_holder<KeyValueCompare> base_t;
|
||||
key_nodeptr_comp(KeyValueCompare kcomp, const Container *cont)
|
||||
: base_t(kcomp), cont_(cont)
|
||||
{}
|
||||
|
||||
template<class T>
|
||||
struct is_node_ptr
|
||||
{
|
||||
static const bool value = is_same<T, const_node_ptr>::value || is_same<T, node_ptr>::value;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
typename enable_if_c<is_node_ptr<T>::value, const value_type &>::type
|
||||
key_forward(const T &node) const
|
||||
{ return *cont_->get_real_value_traits().to_value_ptr(node); }
|
||||
|
||||
template<class T>
|
||||
typename enable_if_c<!is_node_ptr<T>::value, const T &>::type
|
||||
key_forward(const T &key) const
|
||||
{ return key;}
|
||||
|
||||
template<class KeyType, class KeyType2>
|
||||
bool operator()(const KeyType &key1, const KeyType2 &key2) const
|
||||
{ return base_t::get()(this->key_forward(key1), this->key_forward(key2)); }
|
||||
|
||||
const Container *cont_;
|
||||
};
|
||||
|
||||
template<class F, class Container>
|
||||
struct node_cloner
|
||||
: private detail::ebo_functor_holder<F>
|
||||
{
|
||||
typedef typename Container::real_value_traits real_value_traits;
|
||||
typedef typename Container::node_algorithms node_algorithms;
|
||||
typedef typename real_value_traits::value_type value_type;
|
||||
typedef typename real_value_traits::pointer pointer;
|
||||
typedef typename real_value_traits::node_traits::node node;
|
||||
typedef typename real_value_traits::node_ptr node_ptr;
|
||||
typedef typename real_value_traits::const_node_ptr const_node_ptr;
|
||||
typedef detail::ebo_functor_holder<F> base_t;
|
||||
enum { safemode_or_autounlink =
|
||||
(int)real_value_traits::link_mode == (int)auto_unlink ||
|
||||
(int)real_value_traits::link_mode == (int)safe_link };
|
||||
|
||||
node_cloner(F f, const Container *cont)
|
||||
: base_t(f), cont_(cont)
|
||||
{}
|
||||
|
||||
node_ptr operator()(node_ptr p)
|
||||
{ return this->operator()(*p); }
|
||||
|
||||
node_ptr operator()(const node &to_clone)
|
||||
{
|
||||
const value_type &v =
|
||||
*cont_->get_real_value_traits().to_value_ptr(const_node_ptr(&to_clone));
|
||||
node_ptr n = cont_->get_real_value_traits().to_node_ptr(*base_t::get()(v));
|
||||
//Cloned node must be in default mode if the linking mode requires it
|
||||
if(safemode_or_autounlink)
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(n));
|
||||
return n;
|
||||
}
|
||||
|
||||
const Container *cont_;
|
||||
};
|
||||
|
||||
template<class F, class Container>
|
||||
struct node_disposer
|
||||
: private detail::ebo_functor_holder<F>
|
||||
{
|
||||
typedef typename Container::real_value_traits real_value_traits;
|
||||
typedef typename real_value_traits::node_ptr node_ptr;
|
||||
typedef detail::ebo_functor_holder<F> base_t;
|
||||
typedef typename Container::node_algorithms node_algorithms;
|
||||
enum { safemode_or_autounlink =
|
||||
(int)real_value_traits::link_mode == (int)auto_unlink ||
|
||||
(int)real_value_traits::link_mode == (int)safe_link };
|
||||
|
||||
node_disposer(F f, const Container *cont)
|
||||
: base_t(f), cont_(cont)
|
||||
{}
|
||||
|
||||
void operator()(node_ptr p)
|
||||
{
|
||||
if(safemode_or_autounlink)
|
||||
node_algorithms::init(p);
|
||||
base_t::get()(cont_->get_real_value_traits().to_value_ptr(p));
|
||||
}
|
||||
const Container *cont_;
|
||||
};
|
||||
|
||||
struct dummy_constptr
|
||||
{
|
||||
dummy_constptr(const void *)
|
||||
{}
|
||||
|
||||
const void *get_ptr() const
|
||||
{ return 0; }
|
||||
};
|
||||
|
||||
template<class VoidPointer>
|
||||
struct constptr
|
||||
{
|
||||
typedef typename boost::pointer_to_other
|
||||
<VoidPointer, const void>::type ConstVoidPtr;
|
||||
|
||||
constptr(const void *ptr)
|
||||
: const_void_ptr_(ptr)
|
||||
{}
|
||||
|
||||
const void *get_ptr() const
|
||||
{ return detail::boost_intrusive_get_pointer(const_void_ptr_); }
|
||||
|
||||
ConstVoidPtr const_void_ptr_;
|
||||
};
|
||||
|
||||
template <class VoidPointer, bool store_ptr>
|
||||
struct select_constptr
|
||||
{
|
||||
typedef typename detail::if_c
|
||||
< store_ptr
|
||||
, constptr<VoidPointer>
|
||||
, dummy_constptr
|
||||
>::type type;
|
||||
};
|
||||
|
||||
template<class T, bool Add>
|
||||
struct add_const_if_c
|
||||
{
|
||||
typedef typename detail::if_c
|
||||
< Add
|
||||
, typename detail::add_const<T>::type
|
||||
, T
|
||||
>::type type;
|
||||
};
|
||||
|
||||
template <link_mode_type LinkMode>
|
||||
struct link_dispatch
|
||||
{};
|
||||
|
||||
template<class Hook>
|
||||
void destructor_impl(Hook &hook, detail::link_dispatch<safe_link>)
|
||||
{ //If this assertion raises, you might have destroyed an object
|
||||
//while it was still inserted in a container that is alive.
|
||||
//If so, remove the object from the container before destroying it.
|
||||
(void)hook; BOOST_INTRUSIVE_SAFE_HOOK_DESTRUCTOR_ASSERT(!hook.is_linked());
|
||||
}
|
||||
|
||||
template<class Hook>
|
||||
void destructor_impl(Hook &hook, detail::link_dispatch<auto_unlink>)
|
||||
{ hook.unlink(); }
|
||||
|
||||
template<class Hook>
|
||||
void destructor_impl(Hook &, detail::link_dispatch<normal_link>)
|
||||
{}
|
||||
|
||||
template<class T, class NodeTraits, link_mode_type LinkMode, class Tag, int HookType>
|
||||
struct base_hook_traits
|
||||
{
|
||||
public:
|
||||
typedef detail::node_holder
|
||||
<typename NodeTraits::node, Tag, LinkMode, HookType> node_holder;
|
||||
typedef NodeTraits node_traits;
|
||||
typedef T value_type;
|
||||
typedef typename node_traits::node_ptr node_ptr;
|
||||
typedef typename node_traits::const_node_ptr const_node_ptr;
|
||||
typedef typename boost::pointer_to_other<node_ptr, T>::type pointer;
|
||||
typedef typename boost::pointer_to_other<node_ptr, const T>::type const_pointer;
|
||||
typedef typename std::iterator_traits<pointer>::reference reference;
|
||||
typedef typename std::iterator_traits<const_pointer>::reference const_reference;
|
||||
static const link_mode_type link_mode = LinkMode;
|
||||
|
||||
static node_ptr to_node_ptr(reference value)
|
||||
{ return static_cast<node_holder*>(&value); }
|
||||
|
||||
static const_node_ptr to_node_ptr(const_reference value)
|
||||
{ return static_cast<const node_holder*>(&value); }
|
||||
|
||||
static pointer to_value_ptr(node_ptr n)
|
||||
{ return static_cast<T*>(static_cast<node_holder*>(&*n)); }
|
||||
|
||||
static const_pointer to_value_ptr(const_node_ptr n)
|
||||
{ return static_cast<const T*>(static_cast<const node_holder*>(&*n)); }
|
||||
};
|
||||
|
||||
template<class T, class Hook, Hook T::* P>
|
||||
struct member_hook_traits
|
||||
{
|
||||
public:
|
||||
typedef Hook hook_type;
|
||||
typedef typename hook_type::boost_intrusive_tags::node_traits node_traits;
|
||||
typedef typename node_traits::node node;
|
||||
typedef T value_type;
|
||||
typedef typename node_traits::node_ptr node_ptr;
|
||||
typedef typename node_traits::const_node_ptr const_node_ptr;
|
||||
typedef typename boost::pointer_to_other<node_ptr, T>::type pointer;
|
||||
typedef typename boost::pointer_to_other<node_ptr, const T>::type const_pointer;
|
||||
typedef typename std::iterator_traits<pointer>::reference reference;
|
||||
typedef typename std::iterator_traits<const_pointer>::reference const_reference;
|
||||
static const link_mode_type link_mode = Hook::boost_intrusive_tags::link_mode;
|
||||
|
||||
static node_ptr to_node_ptr(reference value)
|
||||
{ return static_cast<node*>(&(value.*P)); }
|
||||
|
||||
static const_node_ptr to_node_ptr(const_reference value)
|
||||
{ return static_cast<const node*>(&(value.*P)); }
|
||||
|
||||
static pointer to_value_ptr(node_ptr n)
|
||||
{
|
||||
return detail::parent_from_member<T, Hook>
|
||||
(static_cast<Hook*>(detail::boost_intrusive_get_pointer(n)), P);
|
||||
}
|
||||
|
||||
static const_pointer to_value_ptr(const_node_ptr n)
|
||||
{
|
||||
return detail::parent_from_member<T, Hook>
|
||||
(static_cast<const Hook*>(detail::boost_intrusive_get_pointer(n)), P);
|
||||
}
|
||||
};
|
||||
|
||||
template<class Functor>
|
||||
struct function_hook_traits
|
||||
{
|
||||
public:
|
||||
typedef typename Functor::hook_type hook_type;
|
||||
typedef typename Functor::hook_ptr hook_ptr;
|
||||
typedef typename Functor::const_hook_ptr const_hook_ptr;
|
||||
typedef typename hook_type::boost_intrusive_tags::node_traits node_traits;
|
||||
typedef typename node_traits::node node;
|
||||
typedef typename Functor::value_type value_type;
|
||||
typedef typename node_traits::node_ptr node_ptr;
|
||||
typedef typename node_traits::const_node_ptr const_node_ptr;
|
||||
typedef typename boost::pointer_to_other<node_ptr, value_type>::type pointer;
|
||||
typedef typename boost::pointer_to_other<node_ptr, const value_type>::type const_pointer;
|
||||
typedef typename std::iterator_traits<pointer>::reference reference;
|
||||
typedef typename std::iterator_traits<const_pointer>::reference const_reference;
|
||||
static const link_mode_type link_mode = hook_type::boost_intrusive_tags::link_mode;
|
||||
|
||||
static node_ptr to_node_ptr(reference value)
|
||||
{ return static_cast<node*>(&*Functor::to_hook_ptr(value)); }
|
||||
|
||||
static const_node_ptr to_node_ptr(const_reference value)
|
||||
{ return static_cast<const node*>(&*Functor::to_hook_ptr(value)); }
|
||||
|
||||
static pointer to_value_ptr(node_ptr n)
|
||||
{ return Functor::to_value_ptr(to_hook_ptr(n)); }
|
||||
|
||||
static const_pointer to_value_ptr(const_node_ptr n)
|
||||
{ return Functor::to_value_ptr(to_hook_ptr(n)); }
|
||||
|
||||
private:
|
||||
static hook_ptr to_hook_ptr(node_ptr n)
|
||||
{ return hook_ptr(&*static_cast<hook_type*>(&*n)); }
|
||||
|
||||
static const_hook_ptr to_hook_ptr(const_node_ptr n)
|
||||
{ return const_hook_ptr(&*static_cast<const hook_type*>(&*n)); }
|
||||
};
|
||||
|
||||
|
||||
//This function uses binary search to discover the
|
||||
//highest set bit of the integer
|
||||
inline std::size_t floor_log2 (std::size_t x)
|
||||
{
|
||||
const std::size_t Bits = sizeof(std::size_t)*CHAR_BIT;
|
||||
const bool Size_t_Bits_Power_2= !(Bits & (Bits-1));
|
||||
BOOST_STATIC_ASSERT(Size_t_Bits_Power_2);
|
||||
|
||||
std::size_t n = x;
|
||||
std::size_t log2 = 0;
|
||||
|
||||
for(std::size_t shift = Bits >> 1; shift; shift >>= 1){
|
||||
std::size_t tmp = n >> shift;
|
||||
if (tmp)
|
||||
log2 += shift, n = tmp;
|
||||
}
|
||||
|
||||
return log2;
|
||||
}
|
||||
|
||||
inline float fast_log2 (float val)
|
||||
{
|
||||
union caster_t
|
||||
{
|
||||
boost::uint32_t x;
|
||||
float val;
|
||||
} caster;
|
||||
|
||||
caster.val = val;
|
||||
boost::uint32_t x = caster.x;
|
||||
const int log_2 = (int)(((x >> 23) & 255) - 128);
|
||||
x &= ~(255 << 23);
|
||||
x += 127 << 23;
|
||||
caster.x = x;
|
||||
val = caster.val;
|
||||
val = ((-1.0f/3) * val + 2) * val - 2.0f/3;
|
||||
|
||||
return (val + log_2);
|
||||
}
|
||||
|
||||
inline std::size_t ceil_log2 (std::size_t x)
|
||||
{
|
||||
return ((x & (x-1))!= 0) + floor_log2(x);
|
||||
}
|
||||
|
||||
template<class SizeType, std::size_t N>
|
||||
struct numbits_eq
|
||||
{
|
||||
static const bool value = sizeof(SizeType)*CHAR_BIT == N;
|
||||
};
|
||||
|
||||
template<class SizeType, class Enabler = void >
|
||||
struct sqrt2_pow_max;
|
||||
|
||||
template <class SizeType>
|
||||
struct sqrt2_pow_max<SizeType, typename enable_if< numbits_eq<SizeType, 32> >::type>
|
||||
{
|
||||
static const boost::uint32_t value = 0xb504f334;
|
||||
static const std::size_t pow = 31;
|
||||
};
|
||||
|
||||
template <class SizeType>
|
||||
struct sqrt2_pow_max<SizeType, typename enable_if< numbits_eq<SizeType, 64> >::type>
|
||||
{
|
||||
static const boost::uint64_t value = 0xb504f333f9de6484ull;
|
||||
static const std::size_t pow = 63;
|
||||
};
|
||||
|
||||
// Returns floor(pow(sqrt(2), x * 2 + 1)).
|
||||
// Defined for X from 0 up to the number of bits in size_t minus 1.
|
||||
inline std::size_t sqrt2_pow_2xplus1 (std::size_t x)
|
||||
{
|
||||
const std::size_t value = (std::size_t)sqrt2_pow_max<std::size_t>::value;
|
||||
const std::size_t pow = (std::size_t)sqrt2_pow_max<std::size_t>::pow;
|
||||
return (value >> (pow - x)) + 1;
|
||||
}
|
||||
|
||||
template<class Container, class Disposer>
|
||||
class exception_disposer
|
||||
{
|
||||
Container *cont_;
|
||||
Disposer &disp_;
|
||||
|
||||
exception_disposer(const exception_disposer&);
|
||||
exception_disposer &operator=(const exception_disposer&);
|
||||
|
||||
public:
|
||||
exception_disposer(Container &cont, Disposer &disp)
|
||||
: cont_(&cont), disp_(disp)
|
||||
{}
|
||||
|
||||
void release()
|
||||
{ cont_ = 0; }
|
||||
|
||||
~exception_disposer()
|
||||
{
|
||||
if(cont_){
|
||||
cont_->clear_and_dispose(disp_);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<class Container, class Disposer>
|
||||
class exception_array_disposer
|
||||
{
|
||||
Container *cont_;
|
||||
Disposer &disp_;
|
||||
typename Container::size_type &constructed_;
|
||||
|
||||
exception_array_disposer(const exception_array_disposer&);
|
||||
exception_array_disposer &operator=(const exception_array_disposer&);
|
||||
|
||||
public:
|
||||
typedef typename Container::size_type size_type;
|
||||
exception_array_disposer
|
||||
(Container &cont, Disposer &disp, size_type &constructed)
|
||||
: cont_(&cont), disp_(disp), constructed_(constructed)
|
||||
{}
|
||||
|
||||
void release()
|
||||
{ cont_ = 0; }
|
||||
|
||||
~exception_array_disposer()
|
||||
{
|
||||
size_type n = constructed_;
|
||||
if(cont_){
|
||||
while(n--){
|
||||
cont_[n].clear_and_dispose(disp_);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<class ValueTraits, bool ExternalValueTraits>
|
||||
struct store_cont_ptr_on_it_impl
|
||||
{
|
||||
static const bool value = is_stateful_value_traits<ValueTraits>::value;
|
||||
};
|
||||
|
||||
template<class ValueTraits>
|
||||
struct store_cont_ptr_on_it_impl<ValueTraits, true>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
template <class Container>
|
||||
struct store_cont_ptr_on_it
|
||||
{
|
||||
typedef typename Container::value_traits value_traits;
|
||||
static const bool value = store_cont_ptr_on_it_impl
|
||||
<value_traits, external_value_traits_is_true<value_traits>::value>::value;
|
||||
};
|
||||
|
||||
template<class Container, bool IsConst>
|
||||
struct node_to_value
|
||||
: public detail::select_constptr
|
||||
< typename boost::pointer_to_other
|
||||
<typename Container::pointer, void>::type
|
||||
, detail::store_cont_ptr_on_it<Container>::value
|
||||
>::type
|
||||
{
|
||||
static const bool store_container_ptr =
|
||||
detail::store_cont_ptr_on_it<Container>::value;
|
||||
|
||||
typedef typename Container::real_value_traits real_value_traits;
|
||||
typedef typename real_value_traits::value_type value_type;
|
||||
typedef typename detail::select_constptr
|
||||
< typename boost::pointer_to_other
|
||||
<typename Container::pointer, void>::type
|
||||
, store_container_ptr >::type Base;
|
||||
typedef typename real_value_traits::node_traits::node node;
|
||||
typedef typename detail::add_const_if_c
|
||||
<value_type, IsConst>::type vtype;
|
||||
typedef typename detail::add_const_if_c
|
||||
<node, IsConst>::type ntype;
|
||||
typedef typename boost::pointer_to_other
|
||||
<typename Container::pointer, ntype>::type npointer;
|
||||
|
||||
node_to_value(const Container *cont)
|
||||
: Base(cont)
|
||||
{}
|
||||
|
||||
typedef vtype & result_type;
|
||||
typedef ntype & first_argument_type;
|
||||
|
||||
const Container *get_container() const
|
||||
{
|
||||
if(store_container_ptr)
|
||||
return static_cast<const Container*>(Base::get_ptr());
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
const real_value_traits *get_real_value_traits() const
|
||||
{
|
||||
if(store_container_ptr)
|
||||
return &this->get_container()->get_real_value_traits();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
result_type operator()(first_argument_type arg) const
|
||||
{ return *(this->get_real_value_traits()->to_value_ptr(npointer(&arg))); }
|
||||
};
|
||||
|
||||
//This is not standard, but should work with all compilers
|
||||
union max_align
|
||||
{
|
||||
char char_;
|
||||
short short_;
|
||||
int int_;
|
||||
long long_;
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
long long long_long_;
|
||||
#endif
|
||||
float float_;
|
||||
double double_;
|
||||
long double long_double_;
|
||||
void * void_ptr_;
|
||||
};
|
||||
|
||||
template<class T, std::size_t N>
|
||||
class array_initializer
|
||||
{
|
||||
public:
|
||||
template<class CommonInitializer>
|
||||
array_initializer(const CommonInitializer &init)
|
||||
{
|
||||
char *init_buf = (char*)rawbuf;
|
||||
std::size_t i = 0;
|
||||
try{
|
||||
for(; i != N; ++i){
|
||||
new(init_buf)T(init);
|
||||
init_buf += sizeof(T);
|
||||
}
|
||||
}
|
||||
catch(...){
|
||||
while(i--){
|
||||
init_buf -= sizeof(T);
|
||||
((T*)init_buf)->~T();
|
||||
}
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
operator T* ()
|
||||
{ return (T*)(rawbuf); }
|
||||
|
||||
operator const T*() const
|
||||
{ return (const T*)(rawbuf); }
|
||||
|
||||
~array_initializer()
|
||||
{
|
||||
char *init_buf = (char*)rawbuf + N*sizeof(T);
|
||||
for(std::size_t i = 0; i != N; ++i){
|
||||
init_buf -= sizeof(T);
|
||||
((T*)init_buf)->~T();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
detail::max_align rawbuf[(N*sizeof(T)-1)/sizeof(detail::max_align)+1];
|
||||
};
|
||||
|
||||
} //namespace detail
|
||||
} //namespace intrusive
|
||||
} //namespace boost
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
#endif //BOOST_INTRUSIVE_DETAIL_UTILITIES_HPP
|
||||
30
test/external/boost/intrusive/detail/workaround.hpp
vendored
Normal file
30
test/external/boost/intrusive/detail/workaround.hpp
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_DETAIL_WRKRND_HPP
|
||||
#define BOOST_INTRUSIVE_DETAIL_WRKRND_HPP
|
||||
|
||||
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2)
|
||||
// C++0x features are only enabled when -std=c++0x or -std=gnu++0x are
|
||||
// passed on the command line, which in turn defines
|
||||
// __GXX_EXPERIMENTAL_CXX0X__. Note: __GXX_EXPERIMENTAL_CPP0X__ is
|
||||
// defined by some very early development versions of GCC 4.3; we will
|
||||
// remove this part of the check in the near future.
|
||||
# if defined(__GXX_EXPERIMENTAL_CPP0X__) || defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
# define BOOST_INTRUSIVE_RVALUE_REFERENCE
|
||||
# define BOOST_INTRUSIVE_VARIADIC_TEMPLATES
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_INTRUSIVE_RVALUE_REFERENCE) && defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
#define BOOST_INTRUSIVE_PERFECT_FORWARDING
|
||||
#endif
|
||||
|
||||
#endif //#ifndef BOOST_INTRUSIVE_DETAIL_WRKRND_HPP
|
||||
Reference in New Issue
Block a user