mirror of
https://github.com/boostorg/intrusive.git
synced 2025-08-02 22:14:35 +02:00
Simplified include dependencies to avoid too many preprocessed source.
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
#include <boost/intrusive/detail/any_node_and_algorithms.hpp>
|
||||
#include <boost/intrusive/options.hpp>
|
||||
#include <boost/intrusive/detail/generic_hook.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/intrusive/pointer_rebind.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
@@ -244,15 +244,15 @@ namespace detail{
|
||||
template<class ValueTraits>
|
||||
struct any_to_get_base_pointer_type
|
||||
{
|
||||
typedef typename pointer_traits<typename ValueTraits::hooktags::node_traits::node_ptr>::template
|
||||
rebind_pointer<void>::type type;
|
||||
typedef typename pointer_rebind
|
||||
<typename ValueTraits::hooktags::node_traits::node_ptr, void>::type type;
|
||||
};
|
||||
|
||||
template<class ValueTraits>
|
||||
struct any_to_get_member_pointer_type
|
||||
{
|
||||
typedef typename pointer_traits
|
||||
<typename ValueTraits::node_ptr>::template rebind_pointer<void>::type type;
|
||||
typedef typename pointer_rebind
|
||||
<typename ValueTraits::node_ptr, void>::type type;
|
||||
};
|
||||
|
||||
//!This option setter specifies that the container
|
||||
|
@@ -18,7 +18,6 @@
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <iterator>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
@@ -16,7 +16,6 @@
|
||||
#include <boost/intrusive/intrusive_fwd.hpp>
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <utility>
|
||||
|
||||
#include <boost/intrusive/detail/assert.hpp>
|
||||
|
@@ -16,7 +16,6 @@
|
||||
#include <boost/intrusive/intrusive_fwd.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/intrusive/bstree.hpp>
|
||||
#include <iterator>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
|
@@ -14,20 +14,17 @@
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <boost/intrusive/intrusive_fwd.hpp>
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
#include <utility>
|
||||
|
||||
#include <boost/intrusive/detail/assert.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/intrusive/intrusive_fwd.hpp>
|
||||
#include <boost/intrusive/bs_set_hook.hpp>
|
||||
#include <boost/intrusive/detail/tree_node.hpp>
|
||||
#include <boost/intrusive/detail/tree_iterator.hpp>
|
||||
#include <boost/intrusive/detail/ebo_functor_holder.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/intrusive/detail/function_detector.hpp>
|
||||
#include <boost/intrusive/detail/is_stateful_value_traits.hpp>
|
||||
#include <boost/intrusive/detail/utilities.hpp>
|
||||
#include <boost/intrusive/detail/default_header_holder.hpp>
|
||||
#include <boost/intrusive/detail/reverse_iterator.hpp>
|
||||
@@ -37,6 +34,12 @@
|
||||
#include <boost/intrusive/parent_from_member.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
|
||||
#include <utility> //pair,lexicographical_compare
|
||||
#include <algorithm> //swap
|
||||
#include <cstddef> //size_t...
|
||||
#include <functional>//less, equal_to
|
||||
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
||||
|
@@ -18,7 +18,6 @@
|
||||
#include <boost/intrusive/intrusive_fwd.hpp>
|
||||
#include <boost/intrusive/detail/assert.hpp>
|
||||
#include <boost/intrusive/detail/uncast.hpp>
|
||||
#include <boost/intrusive/detail/utilities.hpp>
|
||||
#include <boost/intrusive/detail/math.hpp>
|
||||
#include <boost/intrusive/detail/algo_type.hpp>
|
||||
#include <utility>
|
||||
|
@@ -15,7 +15,7 @@
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <boost/intrusive/detail/assert.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/intrusive/pointer_rebind.hpp>
|
||||
#include <cstddef>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
|
||||
@@ -25,8 +25,9 @@ namespace intrusive {
|
||||
template<class VoidPointer>
|
||||
struct any_node
|
||||
{
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>::template rebind_pointer<any_node>::type node_ptr;
|
||||
typedef any_node node;
|
||||
typedef typename pointer_rebind<VoidPointer, node>::type node_ptr;
|
||||
typedef typename pointer_rebind<VoidPointer, const node>::type const_node_ptr;
|
||||
node_ptr node_ptr_1;
|
||||
node_ptr node_ptr_2;
|
||||
node_ptr node_ptr_3;
|
||||
@@ -36,11 +37,9 @@ struct any_node
|
||||
template<class VoidPointer>
|
||||
struct any_list_node_traits
|
||||
{
|
||||
typedef any_node<VoidPointer> node;
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>::template rebind_pointer<node>::type node_ptr;
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>::template rebind_pointer<const node>::type const_node_ptr;
|
||||
typedef any_node<VoidPointer> node;
|
||||
typedef typename node::node_ptr node_ptr;
|
||||
typedef typename node::const_node_ptr const_node_ptr;
|
||||
|
||||
static const node_ptr &get_next(const const_node_ptr & n)
|
||||
{ return n->node_ptr_1; }
|
||||
@@ -59,11 +58,9 @@ struct any_list_node_traits
|
||||
template<class VoidPointer>
|
||||
struct any_slist_node_traits
|
||||
{
|
||||
typedef any_node<VoidPointer> node;
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>::template rebind_pointer<node>::type node_ptr;
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>::template rebind_pointer<const node>::type const_node_ptr;
|
||||
typedef any_node<VoidPointer> node;
|
||||
typedef typename node::node_ptr node_ptr;
|
||||
typedef typename node::const_node_ptr const_node_ptr;
|
||||
|
||||
static const node_ptr &get_next(const const_node_ptr & n)
|
||||
{ return n->node_ptr_1; }
|
||||
@@ -108,12 +105,9 @@ struct any_unordered_node_traits
|
||||
template<class VoidPointer>
|
||||
struct any_rbtree_node_traits
|
||||
{
|
||||
typedef any_node<VoidPointer> node;
|
||||
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>::template rebind_pointer<node>::type node_ptr;
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>::template rebind_pointer<const node>::type const_node_ptr;
|
||||
typedef any_node<VoidPointer> node;
|
||||
typedef typename node::node_ptr node_ptr;
|
||||
typedef typename node::const_node_ptr const_node_ptr;
|
||||
|
||||
typedef std::size_t color;
|
||||
|
||||
@@ -152,12 +146,10 @@ struct any_rbtree_node_traits
|
||||
template<class VoidPointer>
|
||||
struct any_avltree_node_traits
|
||||
{
|
||||
typedef any_node<VoidPointer> node;
|
||||
typedef any_node<VoidPointer> node;
|
||||
typedef typename node::node_ptr node_ptr;
|
||||
typedef typename node::const_node_ptr const_node_ptr;
|
||||
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>::template rebind_pointer<node>::type node_ptr;
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>::template rebind_pointer<const node>::type const_node_ptr;
|
||||
typedef std::size_t balance;
|
||||
|
||||
static const node_ptr &get_parent(const const_node_ptr & n)
|
||||
@@ -198,12 +190,9 @@ struct any_avltree_node_traits
|
||||
template<class VoidPointer>
|
||||
struct any_tree_node_traits
|
||||
{
|
||||
typedef any_node<VoidPointer> node;
|
||||
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>::template rebind_pointer<node>::type node_ptr;
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>::template rebind_pointer<const node>::type const_node_ptr;
|
||||
typedef any_node<VoidPointer> node;
|
||||
typedef typename node::node_ptr node_ptr;
|
||||
typedef typename node::const_node_ptr const_node_ptr;
|
||||
|
||||
static const node_ptr &get_parent(const const_node_ptr & n)
|
||||
{ return n->node_ptr_1; }
|
||||
@@ -229,10 +218,8 @@ class any_node_traits
|
||||
{
|
||||
public:
|
||||
typedef any_node<VoidPointer> node;
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>::template rebind_pointer<node>::type node_ptr;
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>::template rebind_pointer<const node>::type const_node_ptr;
|
||||
typedef typename node::node_ptr node_ptr;
|
||||
typedef typename node::const_node_ptr const_node_ptr;
|
||||
};
|
||||
|
||||
template<class VoidPointer>
|
||||
@@ -243,12 +230,10 @@ class any_algorithms
|
||||
{}
|
||||
|
||||
public:
|
||||
typedef any_node<VoidPointer> node;
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>::template rebind_pointer<node>::type node_ptr;
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>::template rebind_pointer<const node>::type const_node_ptr;
|
||||
typedef any_node_traits<VoidPointer> node_traits;
|
||||
typedef any_node<VoidPointer> node;
|
||||
typedef typename node::node_ptr node_ptr;
|
||||
typedef typename node::const_node_ptr const_node_ptr;
|
||||
typedef any_node_traits<VoidPointer> node_traits;
|
||||
|
||||
//! <b>Requires</b>: node must not be part of any tree.
|
||||
//!
|
||||
|
@@ -14,8 +14,7 @@
|
||||
#define BOOST_INTRUSIVE_AVLTREE_NODE_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <iterator>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/intrusive/pointer_rebind.hpp>
|
||||
#include <boost/intrusive/avltree_algorithms.hpp>
|
||||
#include <boost/intrusive/pointer_plus_bits.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
@@ -33,9 +32,8 @@ namespace intrusive {
|
||||
template<class VoidPointer>
|
||||
struct compact_avltree_node
|
||||
{
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>::template rebind_pointer
|
||||
<compact_avltree_node<VoidPointer> >::type node_ptr;
|
||||
typedef typename pointer_rebind<VoidPointer, compact_avltree_node<VoidPointer> >::type node_ptr;
|
||||
typedef typename pointer_rebind<VoidPointer, const compact_avltree_node<VoidPointer> >::type const_node_ptr;
|
||||
enum balance { negative_t, zero_t, positive_t };
|
||||
node_ptr parent_, left_, right_;
|
||||
};
|
||||
@@ -44,9 +42,8 @@ struct compact_avltree_node
|
||||
template<class VoidPointer>
|
||||
struct avltree_node
|
||||
{
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>::template rebind_pointer
|
||||
<avltree_node<VoidPointer> >::type node_ptr;
|
||||
typedef typename pointer_rebind<VoidPointer, avltree_node<VoidPointer> >::type node_ptr;
|
||||
typedef typename pointer_rebind<VoidPointer, const avltree_node<VoidPointer> >::type const_node_ptr;
|
||||
enum balance { negative_t, zero_t, positive_t };
|
||||
node_ptr parent_, left_, right_;
|
||||
balance balance_;
|
||||
@@ -58,13 +55,8 @@ template<class VoidPointer>
|
||||
struct default_avltree_node_traits_impl
|
||||
{
|
||||
typedef avltree_node<VoidPointer> node;
|
||||
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>::template rebind_pointer
|
||||
<node>::type node_ptr;
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>::template rebind_pointer
|
||||
<const node>::type const_node_ptr;
|
||||
typedef typename node::node_ptr node_ptr;
|
||||
typedef typename node::const_node_ptr const_node_ptr;
|
||||
|
||||
typedef typename node::balance balance;
|
||||
|
||||
@@ -120,13 +112,8 @@ template<class VoidPointer>
|
||||
struct compact_avltree_node_traits_impl
|
||||
{
|
||||
typedef compact_avltree_node<VoidPointer> node;
|
||||
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>::template rebind_pointer
|
||||
<node>::type node_ptr;
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>::template rebind_pointer
|
||||
<const node>::type const_node_ptr;
|
||||
typedef typename node::node_ptr node_ptr;
|
||||
typedef typename node::const_node_ptr const_node_ptr;
|
||||
typedef typename node::balance balance;
|
||||
|
||||
typedef pointer_plus_bits<node_ptr, 2> ptr_bit;
|
||||
|
@@ -15,21 +15,7 @@
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
|
||||
|
||||
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/intrusive/detail/assert.hpp>
|
||||
#include <boost/intrusive/detail/is_stateful_value_traits.hpp>
|
||||
#include <boost/intrusive/detail/memory_util.hpp>
|
||||
#include <boost/intrusive/detail/algo_type.hpp>
|
||||
#include <cstddef>
|
||||
#include <climits>
|
||||
#include <iterator>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <iterator>
|
||||
#include <functional>
|
||||
#include <boost/intrusive/detail/to_raw_pointer.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2011-2013. Distributed under the Boost
|
||||
// (C) Copyright Ion Gaztanaga 2011-2014. 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)
|
||||
//
|
||||
@@ -15,12 +15,9 @@
|
||||
#ifndef BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_DETAILS_INCLUDED
|
||||
#define BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_DETAILS_INCLUDED
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <boost/intrusive/detail/workaround.hpp>
|
||||
#include <boost/intrusive/detail/preprocessor.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
|
||||
//Mark that we don't support 0 arg calls due to compiler ICE in GCC 3.4/4.0/4.1 and
|
||||
@@ -38,6 +35,12 @@
|
||||
dont_care(...);
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct make_dontcare
|
||||
{
|
||||
typedef boost_intrusive_has_member_function_callable_with::dont_care type;
|
||||
};
|
||||
|
||||
struct private_type
|
||||
{
|
||||
static private_type p;
|
||||
@@ -53,7 +56,9 @@
|
||||
|
||||
} //boost_intrusive_has_member_function_callable_with
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_SINGLE_ITERATION
|
||||
#endif
|
||||
|
||||
#endif //BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_DETAILS_INCLUDED
|
||||
|
||||
@@ -100,7 +105,7 @@
|
||||
sizeof(boost_intrusive_has_member_function_callable_with::yes_type) == sizeof(deduce((Base*)(0)));
|
||||
};
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING)
|
||||
#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
template<typename Fun, bool HasFunc
|
||||
BOOST_PP_ENUM_TRAILING(BOOST_PP_ITERATION_FINISH(), BOOST_INTRUSIVE_PP_TEMPLATE_PARAM_VOID_DEFAULT, _)>
|
||||
@@ -115,7 +120,7 @@
|
||||
};
|
||||
//!
|
||||
|
||||
#else //!defined(BOOST_INTRUSIVE_PERFECT_FORWARDING)
|
||||
#else //!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
template<typename Fun, bool HasFunc, class ...Args>
|
||||
struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl);
|
||||
@@ -171,30 +176,23 @@
|
||||
== sizeof(boost_intrusive_has_member_function_callable_with::yes_type);
|
||||
};
|
||||
|
||||
template<typename Fun, class ...DontCares>
|
||||
struct BOOST_PP_CAT( funwrap_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME )
|
||||
: Fun
|
||||
{
|
||||
BOOST_PP_CAT( funwrap_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME )();
|
||||
using Fun::BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME;
|
||||
|
||||
boost_intrusive_has_member_function_callable_with::private_type
|
||||
BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME
|
||||
( DontCares...) const;
|
||||
};
|
||||
|
||||
template<typename Fun, class ...Args>
|
||||
struct BOOST_PP_CAT( BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME), _impl)
|
||||
<Fun, true , Args...>
|
||||
{
|
||||
template<class T>
|
||||
struct make_dontcare
|
||||
|
||||
template<class ...DontCares>
|
||||
struct FunWrapTmpl : Fun
|
||||
{
|
||||
typedef boost_intrusive_has_member_function_callable_with::dont_care type;
|
||||
FunWrapTmpl();
|
||||
using Fun::BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME;
|
||||
|
||||
boost_intrusive_has_member_function_callable_with::private_type
|
||||
BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME
|
||||
( DontCares...) const;
|
||||
};
|
||||
|
||||
typedef BOOST_PP_CAT( funwrap_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME )
|
||||
<Fun, typename make_dontcare<Args>::type...> FunWrap;
|
||||
typedef FunWrapTmpl<typename boost_intrusive_has_member_function_callable_with::make_dontcare<Args>::type...> FunWrap;
|
||||
|
||||
static bool const value = (sizeof(boost_intrusive_has_member_function_callable_with::no_type) ==
|
||||
sizeof(boost_intrusive_has_member_function_callable_with::is_private_type
|
||||
@@ -216,7 +214,7 @@
|
||||
, Args... >
|
||||
{};
|
||||
|
||||
#endif //!defined(BOOST_INTRUSIVE_PERFECT_FORWARDING)
|
||||
#endif //defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END
|
||||
|
||||
@@ -226,7 +224,7 @@
|
||||
|
||||
BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING)
|
||||
#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
#if !defined(_MSC_VER) || (_MSC_VER < 1600)
|
||||
|
||||
@@ -297,34 +295,18 @@
|
||||
};
|
||||
#endif //#if !defined(_MSC_VER) || (_MSC_VER < 1600)
|
||||
|
||||
#else //#if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING)
|
||||
#else //#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
#endif //#if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING)
|
||||
#endif //#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END
|
||||
|
||||
#else //BOOST_PP_ITERATION() == 0
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING)
|
||||
#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN
|
||||
|
||||
template<typename Fun>
|
||||
struct BOOST_PP_CAT( BOOST_PP_CAT(funwrap, BOOST_PP_ITERATION())
|
||||
, BOOST_PP_CAT(_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME))
|
||||
: Fun
|
||||
{
|
||||
BOOST_PP_CAT( BOOST_PP_CAT(funwrap, BOOST_PP_ITERATION())
|
||||
, BOOST_PP_CAT(_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME))();
|
||||
|
||||
using Fun::BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME;
|
||||
boost_intrusive_has_member_function_callable_with::private_type
|
||||
BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME
|
||||
( BOOST_PP_ENUM(BOOST_PP_ITERATION()
|
||||
, BOOST_INTRUSIVE_PP_IDENTITY
|
||||
, boost_intrusive_has_member_function_callable_with::dont_care)) const;
|
||||
};
|
||||
|
||||
template<typename Fun BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), class P)>
|
||||
struct BOOST_PP_CAT( BOOST_PP_CAT(has_member_function_callable_with_
|
||||
, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl)
|
||||
@@ -334,9 +316,18 @@
|
||||
, BOOST_INTRUSIVE_PP_IDENTITY
|
||||
, void)>
|
||||
{
|
||||
typedef BOOST_PP_CAT( BOOST_PP_CAT(funwrap, BOOST_PP_ITERATION())
|
||||
, BOOST_PP_CAT(_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME))<Fun>
|
||||
FunWrap;
|
||||
struct FunWrap : Fun
|
||||
{
|
||||
FunWrap();
|
||||
|
||||
using Fun::BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME;
|
||||
boost_intrusive_has_member_function_callable_with::private_type
|
||||
BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME
|
||||
( BOOST_PP_ENUM(BOOST_PP_ITERATION()
|
||||
, BOOST_INTRUSIVE_PP_IDENTITY
|
||||
, boost_intrusive_has_member_function_callable_with::dont_care)) const;
|
||||
};
|
||||
|
||||
static bool const value =
|
||||
(sizeof(boost_intrusive_has_member_function_callable_with::no_type) ==
|
||||
sizeof(boost_intrusive_has_member_function_callable_with::is_private_type
|
||||
@@ -350,13 +341,13 @@
|
||||
};
|
||||
|
||||
BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END
|
||||
#endif //#if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING)
|
||||
#endif //#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
#endif //BOOST_PP_ITERATION() == 0
|
||||
|
||||
#if BOOST_PP_ITERATION() == BOOST_PP_ITERATION_FINISH()
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING)
|
||||
#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN
|
||||
|
||||
@@ -370,7 +361,7 @@
|
||||
|
||||
BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END
|
||||
|
||||
#endif //#if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING)
|
||||
#endif //#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
#undef BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME
|
||||
#undef BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN
|
||||
|
@@ -14,13 +14,12 @@
|
||||
#define BOOST_INTRUSIVE_HASHTABLE_NODE_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <iterator>
|
||||
#include <boost/intrusive/detail/assert.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/intrusive/detail/utilities.hpp>
|
||||
#include <boost/intrusive/slist.hpp> //make_slist
|
||||
#include <boost/intrusive/trivial_value_traits.hpp>
|
||||
#include <boost/intrusive/slist.hpp> //make_slist
|
||||
#include <cstddef>
|
||||
#include <climits>
|
||||
#include <boost/move/core.hpp>
|
||||
@@ -30,71 +29,6 @@ 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;
|
||||
};
|
||||
|
||||
//We only support LLP64(Win64) or LP64(most Unix) data models
|
||||
#ifdef _WIN64 //In 64 bit windows sizeof(size_t) == sizeof(unsigned long long)
|
||||
#define BOOST_INTRUSIVE_PRIME_C(NUMBER) NUMBER##ULL
|
||||
#define BOOST_INTRUSIVE_64_BIT_SIZE_T 1
|
||||
#else //In 32 bit windows and 32/64 bit unixes sizeof(size_t) == sizeof(unsigned long)
|
||||
#define BOOST_INTRUSIVE_PRIME_C(NUMBER) NUMBER##UL
|
||||
#define BOOST_INTRUSIVE_64_BIT_SIZE_T (((((ULONG_MAX>>16)>>16)>>16)>>15) != 0)
|
||||
#endif
|
||||
|
||||
template<int Dummy>
|
||||
const std::size_t prime_list_holder<Dummy>::prime_list[] = {
|
||||
BOOST_INTRUSIVE_PRIME_C(3), BOOST_INTRUSIVE_PRIME_C(7),
|
||||
BOOST_INTRUSIVE_PRIME_C(11), BOOST_INTRUSIVE_PRIME_C(17),
|
||||
BOOST_INTRUSIVE_PRIME_C(29), BOOST_INTRUSIVE_PRIME_C(53),
|
||||
BOOST_INTRUSIVE_PRIME_C(97), BOOST_INTRUSIVE_PRIME_C(193),
|
||||
BOOST_INTRUSIVE_PRIME_C(389), BOOST_INTRUSIVE_PRIME_C(769),
|
||||
BOOST_INTRUSIVE_PRIME_C(1543), BOOST_INTRUSIVE_PRIME_C(3079),
|
||||
BOOST_INTRUSIVE_PRIME_C(6151), BOOST_INTRUSIVE_PRIME_C(12289),
|
||||
BOOST_INTRUSIVE_PRIME_C(24593), BOOST_INTRUSIVE_PRIME_C(49157),
|
||||
BOOST_INTRUSIVE_PRIME_C(98317), BOOST_INTRUSIVE_PRIME_C(196613),
|
||||
BOOST_INTRUSIVE_PRIME_C(393241), BOOST_INTRUSIVE_PRIME_C(786433),
|
||||
BOOST_INTRUSIVE_PRIME_C(1572869), BOOST_INTRUSIVE_PRIME_C(3145739),
|
||||
BOOST_INTRUSIVE_PRIME_C(6291469), BOOST_INTRUSIVE_PRIME_C(12582917),
|
||||
BOOST_INTRUSIVE_PRIME_C(25165843), BOOST_INTRUSIVE_PRIME_C(50331653),
|
||||
BOOST_INTRUSIVE_PRIME_C(100663319), BOOST_INTRUSIVE_PRIME_C(201326611),
|
||||
BOOST_INTRUSIVE_PRIME_C(402653189), BOOST_INTRUSIVE_PRIME_C(805306457),
|
||||
BOOST_INTRUSIVE_PRIME_C(1610612741), BOOST_INTRUSIVE_PRIME_C(3221225473),
|
||||
#if BOOST_INTRUSIVE_64_BIT_SIZE_T
|
||||
//Taken from Boost.MultiIndex code, thanks to Joaquin M Lopez Munoz.
|
||||
BOOST_INTRUSIVE_PRIME_C(6442450939), BOOST_INTRUSIVE_PRIME_C(12884901893),
|
||||
BOOST_INTRUSIVE_PRIME_C(25769803751), BOOST_INTRUSIVE_PRIME_C(51539607551),
|
||||
BOOST_INTRUSIVE_PRIME_C(103079215111), BOOST_INTRUSIVE_PRIME_C(206158430209),
|
||||
BOOST_INTRUSIVE_PRIME_C(412316860441), BOOST_INTRUSIVE_PRIME_C(824633720831),
|
||||
BOOST_INTRUSIVE_PRIME_C(1649267441651), BOOST_INTRUSIVE_PRIME_C(3298534883309),
|
||||
BOOST_INTRUSIVE_PRIME_C(6597069766657), BOOST_INTRUSIVE_PRIME_C(13194139533299),
|
||||
BOOST_INTRUSIVE_PRIME_C(26388279066623), BOOST_INTRUSIVE_PRIME_C(52776558133303),
|
||||
BOOST_INTRUSIVE_PRIME_C(105553116266489), BOOST_INTRUSIVE_PRIME_C(211106232532969),
|
||||
BOOST_INTRUSIVE_PRIME_C(422212465066001), BOOST_INTRUSIVE_PRIME_C(844424930131963),
|
||||
BOOST_INTRUSIVE_PRIME_C(1688849860263953), BOOST_INTRUSIVE_PRIME_C(3377699720527861),
|
||||
BOOST_INTRUSIVE_PRIME_C(6755399441055731), BOOST_INTRUSIVE_PRIME_C(13510798882111483),
|
||||
BOOST_INTRUSIVE_PRIME_C(27021597764222939), BOOST_INTRUSIVE_PRIME_C(54043195528445957),
|
||||
BOOST_INTRUSIVE_PRIME_C(108086391056891903), BOOST_INTRUSIVE_PRIME_C(216172782113783843),
|
||||
BOOST_INTRUSIVE_PRIME_C(432345564227567621), BOOST_INTRUSIVE_PRIME_C(864691128455135207),
|
||||
BOOST_INTRUSIVE_PRIME_C(1729382256910270481), BOOST_INTRUSIVE_PRIME_C(3458764513820540933),
|
||||
BOOST_INTRUSIVE_PRIME_C(6917529027641081903), BOOST_INTRUSIVE_PRIME_C(13835058055282163729),
|
||||
BOOST_INTRUSIVE_PRIME_C(18446744073709551557)
|
||||
#else
|
||||
BOOST_INTRUSIVE_PRIME_C(4294967291)
|
||||
#endif
|
||||
};
|
||||
|
||||
#undef BOOST_INTRUSIVE_PRIME_C
|
||||
#undef BOOST_INTRUSIVE_64_BIT_SIZE_T
|
||||
|
||||
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
|
||||
{
|
||||
@@ -214,7 +148,7 @@ struct get_slist_impl
|
||||
template<class BucketValueTraits, bool IsConst>
|
||||
class hashtable_iterator
|
||||
{
|
||||
typedef std::iterator
|
||||
typedef boost::intrusive::iterator
|
||||
< std::forward_iterator_tag
|
||||
, typename BucketValueTraits::value_traits::value_type
|
||||
, typename pointer_traits<typename BucketValueTraits::value_traits::value_type*>::difference_type
|
||||
|
226
include/boost/intrusive/detail/iiterator.hpp
Normal file
226
include/boost/intrusive/detail/iiterator.hpp
Normal file
@@ -0,0 +1,226 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2006-2014
|
||||
//
|
||||
// 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_IITERATOR_HPP
|
||||
#define BOOST_INTRUSIVE_DETAIL_IITERATOR_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/intrusive/detail/is_stateful_value_traits.hpp>
|
||||
#include <boost/intrusive/detail/std_fwd.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
||||
template<class Category, class T, class Distance, class Pointer, class Reference>
|
||||
struct iterator
|
||||
{
|
||||
typedef Category iterator_category;
|
||||
typedef T value_type;
|
||||
typedef Distance difference_type;
|
||||
typedef Pointer pointer;
|
||||
typedef Reference reference;
|
||||
};
|
||||
|
||||
template<class Iterator>
|
||||
struct iterator_traits
|
||||
{
|
||||
typedef typename Iterator::difference_type difference_type;
|
||||
typedef typename Iterator::value_type value_type;
|
||||
typedef typename Iterator::pointer pointer;
|
||||
typedef typename Iterator::reference reference;
|
||||
typedef typename Iterator::iterator_category iterator_category;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct iterator_traits<T*>
|
||||
{
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef T value_type;
|
||||
typedef T* pointer;
|
||||
typedef T& reference;
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct iterator_traits<const T*>
|
||||
{
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef T value_type;
|
||||
typedef const T* pointer;
|
||||
typedef const T& reference;
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
};
|
||||
|
||||
template<class ValueTraits>
|
||||
struct value_traits_pointers
|
||||
{
|
||||
typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT
|
||||
(boost::intrusive::detail::
|
||||
, ValueTraits, value_traits_ptr
|
||||
, typename pointer_traits<typename ValueTraits::node_traits::node_ptr>::template
|
||||
rebind_pointer<ValueTraits>::type) value_traits_ptr;
|
||||
|
||||
typedef typename pointer_traits<value_traits_ptr>::template
|
||||
rebind_pointer<ValueTraits const>::type const_value_traits_ptr;
|
||||
};
|
||||
|
||||
template<class ValueTraits, bool IsConst, class Category>
|
||||
struct iiterator
|
||||
{
|
||||
typedef ValueTraits value_traits;
|
||||
typedef typename value_traits::node_traits node_traits;
|
||||
typedef typename node_traits::node node;
|
||||
typedef typename node_traits::node_ptr node_ptr;
|
||||
typedef ::boost::intrusive::pointer_traits<node_ptr> nodepointer_traits_t;
|
||||
typedef typename nodepointer_traits_t::template
|
||||
rebind_pointer<void>::type void_pointer;
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef typename ValueTraits::pointer nonconst_pointer;
|
||||
typedef typename ValueTraits::const_pointer yesconst_pointer;
|
||||
typedef typename ::boost::intrusive::pointer_traits
|
||||
<nonconst_pointer>::reference nonconst_reference;
|
||||
typedef typename ::boost::intrusive::pointer_traits
|
||||
<yesconst_pointer>::reference yesconst_reference;
|
||||
typedef typename nodepointer_traits_t::difference_type difference_type;
|
||||
typedef typename detail::if_c
|
||||
<IsConst, yesconst_pointer, nonconst_pointer>::type pointer;
|
||||
typedef typename detail::if_c
|
||||
<IsConst, yesconst_reference, nonconst_reference>::type reference;
|
||||
typedef iterator
|
||||
< Category
|
||||
, value_type
|
||||
, difference_type
|
||||
, pointer
|
||||
, reference
|
||||
> iterator_traits;
|
||||
typedef typename value_traits_pointers
|
||||
<ValueTraits>::value_traits_ptr value_traits_ptr;
|
||||
typedef typename value_traits_pointers
|
||||
<ValueTraits>::const_value_traits_ptr const_value_traits_ptr;
|
||||
static const bool stateful_value_traits =
|
||||
detail::is_stateful_value_traits<value_traits>::value;
|
||||
};
|
||||
|
||||
template<class NodePtr, class StoredPointer, bool StatefulValueTraits = true>
|
||||
struct iiterator_members
|
||||
{
|
||||
|
||||
iiterator_members()
|
||||
: nodeptr_()//Value initialization to achieve "null iterators" (N3644)
|
||||
{}
|
||||
|
||||
iiterator_members(const NodePtr &n_ptr, const StoredPointer &data)
|
||||
: nodeptr_(n_ptr), ptr_(data)
|
||||
{}
|
||||
|
||||
StoredPointer get_ptr() const
|
||||
{ return ptr_; }
|
||||
|
||||
NodePtr nodeptr_;
|
||||
StoredPointer ptr_;
|
||||
};
|
||||
|
||||
template<class NodePtr, class StoredPointer>
|
||||
struct iiterator_members<NodePtr, StoredPointer, false>
|
||||
{
|
||||
iiterator_members()
|
||||
: nodeptr_()//Value initialization to achieve "null iterators" (N3644)
|
||||
{}
|
||||
|
||||
iiterator_members(const NodePtr &n_ptr, const StoredPointer &)
|
||||
: nodeptr_(n_ptr)
|
||||
{}
|
||||
|
||||
StoredPointer get_ptr() const
|
||||
{ return StoredPointer(); }
|
||||
|
||||
NodePtr nodeptr_;
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<class InputIt, class Distance> inline
|
||||
void advance_impl(InputIt& it, Distance n, const std::input_iterator_tag&)
|
||||
{
|
||||
while(n--)
|
||||
++it;
|
||||
}
|
||||
|
||||
template<class InputIt, class Distance> inline
|
||||
void advance_impl(InputIt& it, Distance n, std::forward_iterator_tag &)
|
||||
{
|
||||
while(n--)
|
||||
++it;
|
||||
}
|
||||
|
||||
template<class InputIt, class Distance> inline
|
||||
void advance_impl(InputIt& it, Distance n, std::bidirectional_iterator_tag &)
|
||||
{
|
||||
for (; 0 < n; --n)
|
||||
++it;
|
||||
for (; n < 0; ++n)
|
||||
--it;
|
||||
}
|
||||
|
||||
template<class InputIt, class Distance>
|
||||
inline void advance_impl(InputIt& it, Distance n, const std::random_access_iterator_tag &)
|
||||
{
|
||||
it += n;
|
||||
}
|
||||
|
||||
} //namespace detail
|
||||
|
||||
template<class InputIt, class Distance>
|
||||
inline void iterator_advance(InputIt& it, Distance n)
|
||||
{ // increment iterator by offset, arbitrary iterators
|
||||
boost::intrusive::detail::advance_impl(it, n, boost::intrusive::iterator_traits<InputIt>::iterator_category());
|
||||
}
|
||||
|
||||
namespace detail{
|
||||
|
||||
template<class InputIt, class Distance, class Category>
|
||||
inline void distance_impl(InputIt first, InputIt last, Distance& off, const Category &)
|
||||
{
|
||||
while(first != last){
|
||||
++off;
|
||||
++first;
|
||||
}
|
||||
}
|
||||
|
||||
template<class InputIt, class Distance> inline
|
||||
void distance_impl(InputIt first, InputIt last, Distance& off, const std::random_access_iterator_tag&)
|
||||
{
|
||||
off += last - first;
|
||||
}
|
||||
|
||||
} //namespace detail
|
||||
|
||||
template<class InputIt> inline
|
||||
typename iterator_traits<InputIt>::difference_type iterator_distance(InputIt first, InputIt last)
|
||||
{
|
||||
typename iterator_traits<InputIt>::difference_type off = 0;
|
||||
boost::intrusive::detail::distance_impl(first, last, off, boost::intrusive::iterator_traits<InputIt>::iterator_category());
|
||||
return off;
|
||||
}
|
||||
|
||||
|
||||
} //namespace intrusive
|
||||
} //namespace boost
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
#endif //BOOST_INTRUSIVE_DETAIL_IITERATOR_HPP
|
128
include/boost/intrusive/detail/list_iterator.hpp
Normal file
128
include/boost/intrusive/detail/list_iterator.hpp
Normal file
@@ -0,0 +1,128 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||
//
|
||||
// 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_ITERATOR_HPP
|
||||
#define BOOST_INTRUSIVE_LIST_ITERATOR_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <boost/intrusive/detail/std_fwd.hpp>
|
||||
#include <boost/intrusive/detail/iiterator.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
||||
// list_iterator provides some basic functions for a
|
||||
// node oriented bidirectional iterator:
|
||||
template<class ValueTraits, bool IsConst>
|
||||
class list_iterator
|
||||
{
|
||||
protected:
|
||||
typedef iiterator
|
||||
<ValueTraits, IsConst, std::bidirectional_iterator_tag> types_t;
|
||||
|
||||
static const bool stateful_value_traits = types_t::stateful_value_traits;
|
||||
|
||||
typedef ValueTraits value_traits;
|
||||
typedef typename types_t::node_traits node_traits;
|
||||
|
||||
typedef typename types_t::node node;
|
||||
typedef typename types_t::node_ptr node_ptr;
|
||||
typedef typename types_t::const_value_traits_ptr const_value_traits_ptr;
|
||||
|
||||
public:
|
||||
typedef typename types_t::iterator_traits::difference_type difference_type;
|
||||
typedef typename types_t::iterator_traits::value_type value_type;
|
||||
typedef typename types_t::iterator_traits::pointer pointer;
|
||||
typedef typename types_t::iterator_traits::reference reference;
|
||||
typedef typename types_t::iterator_traits::iterator_category iterator_category;
|
||||
|
||||
list_iterator()
|
||||
{}
|
||||
|
||||
explicit list_iterator(const node_ptr & nodeptr, const const_value_traits_ptr &traits_ptr)
|
||||
: members_(nodeptr, traits_ptr)
|
||||
{}
|
||||
|
||||
list_iterator(list_iterator<ValueTraits, false> const& other)
|
||||
: members_(other.pointed_node(), other.get_value_traits())
|
||||
{}
|
||||
|
||||
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); }
|
||||
|
||||
const_value_traits_ptr get_value_traits() const
|
||||
{ return members_.get_ptr(); }
|
||||
|
||||
public:
|
||||
list_iterator& operator++()
|
||||
{
|
||||
node_ptr p = node_traits::get_next(members_.nodeptr_);
|
||||
members_.nodeptr_ = p;
|
||||
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 this->operator_arrow(detail::bool_<stateful_value_traits>()); }
|
||||
|
||||
list_iterator<ValueTraits, false> unconst() const
|
||||
{ return list_iterator<ValueTraits, false>(this->pointed_node(), this->get_value_traits()); }
|
||||
|
||||
private:
|
||||
pointer operator_arrow(detail::false_) const
|
||||
{ return ValueTraits::to_value_ptr(members_.nodeptr_); }
|
||||
|
||||
pointer operator_arrow(detail::true_) const
|
||||
{ return this->get_value_traits()->to_value_ptr(members_.nodeptr_); }
|
||||
|
||||
iiterator_members<node_ptr, const_value_traits_ptr, stateful_value_traits> members_;
|
||||
};
|
||||
|
||||
} //namespace intrusive
|
||||
} //namespace boost
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
#endif //BOOST_INTRUSIVE_LIST_ITERATOR_HPP
|
@@ -15,10 +15,7 @@
|
||||
#define BOOST_INTRUSIVE_LIST_NODE_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <iterator>
|
||||
#include <boost/intrusive/detail/assert.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/intrusive/detail/memory_util.hpp>
|
||||
#include <boost/intrusive/pointer_rebind.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
@@ -30,8 +27,7 @@ namespace intrusive {
|
||||
template<class VoidPointer>
|
||||
struct list_node
|
||||
{
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>:: template rebind_pointer<list_node>::type node_ptr;
|
||||
typedef typename pointer_rebind<VoidPointer, list_node>::type node_ptr;
|
||||
node_ptr next_;
|
||||
node_ptr prev_;
|
||||
};
|
||||
@@ -39,11 +35,9 @@ struct list_node
|
||||
template<class VoidPointer>
|
||||
struct list_node_traits
|
||||
{
|
||||
typedef list_node<VoidPointer> node;
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>:: template rebind_pointer<node>::type node_ptr;
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>:: template rebind_pointer<const node>::type const_node_ptr;
|
||||
typedef list_node<VoidPointer> node;
|
||||
typedef typename node::node_ptr node_ptr;
|
||||
typedef typename pointer_rebind<VoidPointer, const node>::type const_node_ptr;
|
||||
|
||||
static node_ptr get_previous(const const_node_ptr & n)
|
||||
{ return n->prev_; }
|
||||
@@ -64,104 +58,6 @@ struct list_node_traits
|
||||
{ n->next_ = next; }
|
||||
};
|
||||
|
||||
// list_iterator provides some basic functions for a
|
||||
// node oriented bidirectional iterator:
|
||||
template<class ValueTraits, bool IsConst>
|
||||
class list_iterator
|
||||
{
|
||||
protected:
|
||||
typedef iiterator
|
||||
<ValueTraits, IsConst, std::bidirectional_iterator_tag> types_t;
|
||||
|
||||
static const bool stateful_value_traits = types_t::stateful_value_traits;
|
||||
|
||||
typedef ValueTraits value_traits;
|
||||
typedef typename types_t::node_traits node_traits;
|
||||
|
||||
typedef typename types_t::node node;
|
||||
typedef typename types_t::node_ptr node_ptr;
|
||||
typedef typename types_t::const_value_traits_ptr const_value_traits_ptr;
|
||||
|
||||
public:
|
||||
typedef typename types_t::iterator_traits::difference_type difference_type;
|
||||
typedef typename types_t::iterator_traits::value_type value_type;
|
||||
typedef typename types_t::iterator_traits::pointer pointer;
|
||||
typedef typename types_t::iterator_traits::reference reference;
|
||||
typedef typename types_t::iterator_traits::iterator_category iterator_category;
|
||||
|
||||
list_iterator()
|
||||
{}
|
||||
|
||||
explicit list_iterator(const node_ptr & nodeptr, const const_value_traits_ptr &traits_ptr)
|
||||
: members_(nodeptr, traits_ptr)
|
||||
{}
|
||||
|
||||
list_iterator(list_iterator<ValueTraits, false> const& other)
|
||||
: members_(other.pointed_node(), other.get_value_traits())
|
||||
{}
|
||||
|
||||
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); }
|
||||
|
||||
const_value_traits_ptr get_value_traits() const
|
||||
{ return members_.get_ptr(); }
|
||||
|
||||
public:
|
||||
list_iterator& operator++()
|
||||
{
|
||||
node_ptr p = node_traits::get_next(members_.nodeptr_);
|
||||
members_.nodeptr_ = p;
|
||||
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 this->operator_arrow(detail::bool_<stateful_value_traits>()); }
|
||||
|
||||
list_iterator<ValueTraits, false> unconst() const
|
||||
{ return list_iterator<ValueTraits, false>(this->pointed_node(), this->get_value_traits()); }
|
||||
|
||||
private:
|
||||
pointer operator_arrow(detail::false_) const
|
||||
{ return ValueTraits::to_value_ptr(members_.nodeptr_); }
|
||||
|
||||
pointer operator_arrow(detail::true_) const
|
||||
{ return this->get_value_traits()->to_value_ptr(members_.nodeptr_); }
|
||||
|
||||
iiterator_members<node_ptr, const_value_traits_ptr, stateful_value_traits> members_;
|
||||
};
|
||||
|
||||
} //namespace intrusive
|
||||
} //namespace boost
|
||||
|
||||
|
@@ -42,14 +42,6 @@ inline T* addressof(T& obj)
|
||||
);
|
||||
}
|
||||
|
||||
template <typename T> struct unvoid { typedef T type; };
|
||||
template <> struct unvoid<void> { struct type { }; };
|
||||
template <> struct unvoid<const void> { struct type { }; };
|
||||
|
||||
template <typename T> struct unvoid_ref { typedef T &type; };
|
||||
template <> struct unvoid_ref<void> { struct type_impl { }; typedef type_impl & type; };
|
||||
template <> struct unvoid_ref<const void> { struct type_impl { }; typedef type_impl & type; };
|
||||
|
||||
template <typename T>
|
||||
struct LowPriorityConversion
|
||||
{
|
||||
@@ -57,59 +49,6 @@ struct LowPriorityConversion
|
||||
LowPriorityConversion(const T&) { }
|
||||
};
|
||||
|
||||
// Infrastructure for providing a default type for T::TNAME if absent.
|
||||
#define BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(TNAME) \
|
||||
template <typename T, typename DefaultType> \
|
||||
struct boost_intrusive_default_type_ ## TNAME \
|
||||
{ \
|
||||
template <typename X> \
|
||||
static char test(int, typename X::TNAME*); \
|
||||
\
|
||||
template <typename X> \
|
||||
static int test(...); \
|
||||
\
|
||||
struct DefaultWrap { typedef DefaultType TNAME; }; \
|
||||
\
|
||||
static const bool value = (1 == sizeof(test<T>(0, 0))); \
|
||||
\
|
||||
typedef typename \
|
||||
::boost::intrusive::detail::if_c \
|
||||
<value, T, DefaultWrap>::type::TNAME type; \
|
||||
}; \
|
||||
\
|
||||
template <typename T, typename DefaultType> \
|
||||
struct boost_intrusive_eval_default_type_ ## TNAME \
|
||||
{ \
|
||||
template <typename X> \
|
||||
static char test(int, typename X::TNAME*); \
|
||||
\
|
||||
template <typename X> \
|
||||
static int test(...); \
|
||||
\
|
||||
struct DefaultWrap \
|
||||
{ typedef typename DefaultType::type TNAME; }; \
|
||||
\
|
||||
static const bool value = (1 == sizeof(test<T>(0, 0))); \
|
||||
\
|
||||
typedef typename \
|
||||
::boost::intrusive::detail::eval_if_c \
|
||||
< value \
|
||||
, ::boost::intrusive::detail::identity<T> \
|
||||
, ::boost::intrusive::detail::identity<DefaultWrap> \
|
||||
>::type::TNAME type; \
|
||||
}; \
|
||||
//
|
||||
|
||||
#define BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(INSTANTIATION_NS_PREFIX, T, TNAME, TIMPL) \
|
||||
typename INSTANTIATION_NS_PREFIX \
|
||||
boost_intrusive_default_type_ ## TNAME< T, TIMPL >::type \
|
||||
//
|
||||
|
||||
#define BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(INSTANTIATION_NS_PREFIX, T, TNAME, TIMPL) \
|
||||
typename INSTANTIATION_NS_PREFIX \
|
||||
boost_intrusive_eval_default_type_ ## TNAME< T, TIMPL >::type \
|
||||
//
|
||||
|
||||
}}} //namespace boost::intrusive::detail
|
||||
|
||||
#include <boost/intrusive/detail/has_member_function_callable_with.hpp>
|
||||
@@ -147,260 +86,6 @@ BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(difference_type)
|
||||
BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(reference)
|
||||
BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(value_traits_ptr)
|
||||
|
||||
//////////////////////
|
||||
//struct first_param
|
||||
//////////////////////
|
||||
|
||||
template <typename T> struct first_param
|
||||
{ typedef void type; };
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
template <template <typename, typename...> class TemplateClass, typename T, typename... Args>
|
||||
struct first_param< TemplateClass<T, Args...> >
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
#else //C++03 compilers
|
||||
|
||||
template < template //0arg
|
||||
<class
|
||||
> class TemplateClass, class T
|
||||
>
|
||||
struct first_param
|
||||
< TemplateClass<T> >
|
||||
{ typedef T type; };
|
||||
|
||||
template < template //1arg
|
||||
<class,class
|
||||
> class TemplateClass, class T
|
||||
, class P0>
|
||||
struct first_param
|
||||
< TemplateClass<T, P0> >
|
||||
{ typedef T type; };
|
||||
|
||||
template < template //2arg
|
||||
<class,class,class
|
||||
> class TemplateClass, class T
|
||||
, class P0, class P1>
|
||||
struct first_param
|
||||
< TemplateClass<T, P0, P1> >
|
||||
{ typedef T type; };
|
||||
|
||||
template < template //3arg
|
||||
<class,class,class,class
|
||||
> class TemplateClass, class T
|
||||
, class P0, class P1, class P2>
|
||||
struct first_param
|
||||
< TemplateClass<T, P0, P1, P2> >
|
||||
{ typedef T type; };
|
||||
|
||||
template < template //4arg
|
||||
<class,class,class,class,class
|
||||
> class TemplateClass, class T
|
||||
, class P0, class P1, class P2, class P3>
|
||||
struct first_param
|
||||
< TemplateClass<T, P0, P1, P2, P3> >
|
||||
{ typedef T type; };
|
||||
|
||||
template < template //5arg
|
||||
<class,class,class,class,class,class
|
||||
> class TemplateClass, class T
|
||||
, class P0, class P1, class P2, class P3, class P4>
|
||||
struct first_param
|
||||
< TemplateClass<T, P0, P1, P2, P3, P4> >
|
||||
{ typedef T type; };
|
||||
|
||||
template < template //6arg
|
||||
<class,class,class,class,class,class,class
|
||||
> class TemplateClass, class T
|
||||
, class P0, class P1, class P2, class P3, class P4, class P5>
|
||||
struct first_param
|
||||
< TemplateClass<T, P0, P1, P2, P3, P4, P5> >
|
||||
{ typedef T type; };
|
||||
|
||||
template < template //7arg
|
||||
<class,class,class,class,class,class,class,class
|
||||
> class TemplateClass, class T
|
||||
, class P0, class P1, class P2, class P3, class P4, class P5, class P6>
|
||||
struct first_param
|
||||
< TemplateClass<T, P0, P1, P2, P3, P4, P5, P6> >
|
||||
{ typedef T type; };
|
||||
|
||||
template < template //8arg
|
||||
<class,class,class,class,class,class,class,class,class
|
||||
> class TemplateClass, class T
|
||||
, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7>
|
||||
struct first_param
|
||||
< TemplateClass<T, P0, P1, P2, P3, P4, P5, P6, P7> >
|
||||
{ typedef T type; };
|
||||
|
||||
template < template //9arg
|
||||
<class,class,class,class,class,class,class,class,class,class
|
||||
> class TemplateClass, class T
|
||||
, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8>
|
||||
struct first_param
|
||||
< TemplateClass<T, P0, P1, P2, P3, P4, P5, P6, P7, P8> >
|
||||
{ typedef T type; };
|
||||
|
||||
template < template //10arg
|
||||
<class,class,class,class,class,class,class,class,class,class,class
|
||||
> class TemplateClass, class T
|
||||
, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9>
|
||||
struct first_param
|
||||
< TemplateClass<T, P0, P1, P2, P3, P4, P5, P6, P7, P8, P9> >
|
||||
{ typedef T type; };
|
||||
|
||||
#endif //!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
///////////////////////////
|
||||
//struct type_rebind_mode
|
||||
///////////////////////////
|
||||
template <typename Ptr, typename T>
|
||||
struct type_has_rebind
|
||||
{
|
||||
template <typename X>
|
||||
static char test(int, typename X::template rebind<T>*);
|
||||
|
||||
template <typename X>
|
||||
static int test(boost::intrusive::detail::LowPriorityConversion<int>, void*);
|
||||
|
||||
static const bool value = (1 == sizeof(test<Ptr>(0, 0)));
|
||||
};
|
||||
|
||||
template <typename Ptr, typename T>
|
||||
struct type_has_rebind_other
|
||||
{
|
||||
template <typename X>
|
||||
static char test(int, typename X::template rebind<T>::other*);
|
||||
|
||||
template <typename X>
|
||||
static int test(boost::intrusive::detail::LowPriorityConversion<int>, void*);
|
||||
|
||||
static const bool value = (1 == sizeof(test<Ptr>(0, 0)));
|
||||
};
|
||||
|
||||
template <typename Ptr, typename T>
|
||||
struct type_rebind_mode
|
||||
{
|
||||
static const unsigned int rebind = (unsigned int)type_has_rebind<Ptr, T>::value;
|
||||
static const unsigned int rebind_other = (unsigned int)type_has_rebind_other<Ptr, T>::value;
|
||||
static const unsigned int mode = rebind + rebind*rebind_other;
|
||||
};
|
||||
|
||||
////////////////////////
|
||||
//struct type_rebinder
|
||||
////////////////////////
|
||||
template <typename Ptr, typename U, unsigned int RebindMode = type_rebind_mode<Ptr, U>::mode>
|
||||
struct type_rebinder;
|
||||
|
||||
// Implementation of pointer_traits<Ptr>::rebind if Ptr has
|
||||
// its own rebind::other type (C++03)
|
||||
template <typename Ptr, typename U>
|
||||
struct type_rebinder< Ptr, U, 2u >
|
||||
{
|
||||
typedef typename Ptr::template rebind<U>::other type;
|
||||
};
|
||||
|
||||
// Implementation of pointer_traits<Ptr>::rebind if Ptr has
|
||||
// its own rebind template.
|
||||
template <typename Ptr, typename U>
|
||||
struct type_rebinder< Ptr, U, 1u >
|
||||
{
|
||||
typedef typename Ptr::template rebind<U> type;
|
||||
};
|
||||
|
||||
// Specialization of pointer_traits<Ptr>::rebind if Ptr does not
|
||||
// have its own rebind template but has a the form Ptr<class T,
|
||||
// OtherArgs>, where OtherArgs comprises zero or more type parameters.
|
||||
// Many pointers fit this form, hence many pointers will get a
|
||||
// reasonable default for rebind.
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
template <template <class, class...> class Ptr, typename T, class... Tn, class U>
|
||||
struct type_rebinder<Ptr<T, Tn...>, U, 0u >
|
||||
{
|
||||
typedef Ptr<U, Tn...> type;
|
||||
};
|
||||
|
||||
//Needed for non-conforming compilers like GCC 4.3
|
||||
template <template <class> class Ptr, typename T, class U>
|
||||
struct type_rebinder<Ptr<T>, U, 0u >
|
||||
{
|
||||
typedef Ptr<U> type;
|
||||
};
|
||||
|
||||
#else //C++03 compilers
|
||||
|
||||
template <template <class> class Ptr //0arg
|
||||
, typename T
|
||||
, class U>
|
||||
struct type_rebinder<Ptr<T>, U, 0u>
|
||||
{ typedef Ptr<U> type; };
|
||||
|
||||
template <template <class, class> class Ptr //1arg
|
||||
, typename T, class P0
|
||||
, class U>
|
||||
struct type_rebinder<Ptr<T, P0>, U, 0u>
|
||||
{ typedef Ptr<U, P0> type; };
|
||||
|
||||
template <template <class, class, class> class Ptr //2arg
|
||||
, typename T, class P0, class P1
|
||||
, class U>
|
||||
struct type_rebinder<Ptr<T, P0, P1>, U, 0u>
|
||||
{ typedef Ptr<U, P0, P1> type; };
|
||||
|
||||
template <template <class, class, class, class> class Ptr //3arg
|
||||
, typename T, class P0, class P1, class P2
|
||||
, class U>
|
||||
struct type_rebinder<Ptr<T, P0, P1, P2>, U, 0u>
|
||||
{ typedef Ptr<U, P0, P1, P2> type; };
|
||||
|
||||
template <template <class, class, class, class, class> class Ptr //4arg
|
||||
, typename T, class P0, class P1, class P2, class P3
|
||||
, class U>
|
||||
struct type_rebinder<Ptr<T, P0, P1, P2, P3>, U, 0u>
|
||||
{ typedef Ptr<U, P0, P1, P2, P3> type; };
|
||||
|
||||
template <template <class, class, class, class, class, class> class Ptr //5arg
|
||||
, typename T, class P0, class P1, class P2, class P3, class P4
|
||||
, class U>
|
||||
struct type_rebinder<Ptr<T, P0, P1, P2, P3, P4>, U, 0u>
|
||||
{ typedef Ptr<U, P0, P1, P2, P3, P4> type; };
|
||||
|
||||
template <template <class, class, class, class, class, class, class> class Ptr //6arg
|
||||
, typename T, class P0, class P1, class P2, class P3, class P4, class P5
|
||||
, class U>
|
||||
struct type_rebinder<Ptr<T, P0, P1, P2, P3, P4, P5>, U, 0u>
|
||||
{ typedef Ptr<U, P0, P1, P2, P3, P4, P5> type; };
|
||||
|
||||
template <template <class, class, class, class, class, class, class, class> class Ptr //7arg
|
||||
, typename T, class P0, class P1, class P2, class P3, class P4, class P5, class P6
|
||||
, class U>
|
||||
struct type_rebinder<Ptr<T, P0, P1, P2, P3, P4, P5, P6>, U, 0u>
|
||||
{ typedef Ptr<U, P0, P1, P2, P3, P4, P5, P6> type; };
|
||||
|
||||
template <template <class, class, class, class, class, class, class, class, class> class Ptr //8arg
|
||||
, typename T, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7
|
||||
, class U>
|
||||
struct type_rebinder<Ptr<T, P0, P1, P2, P3, P4, P5, P6, P7>, U, 0u>
|
||||
{ typedef Ptr<U, P0, P1, P2, P3, P4, P5, P6, P7> type; };
|
||||
|
||||
template <template <class, class, class, class, class, class, class, class, class, class> class Ptr //9arg
|
||||
, typename T, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8
|
||||
, class U>
|
||||
struct type_rebinder<Ptr<T, P0, P1, P2, P3, P4, P5, P6, P7, P8>, U, 0u>
|
||||
{ typedef Ptr<U, P0, P1, P2, P3, P4, P5, P6, P7, P8> type; };
|
||||
|
||||
template <template <class, class, class, class, class, class, class, class, class, class, class> class Ptr //10arg
|
||||
, typename T, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9
|
||||
, class U>
|
||||
struct type_rebinder<Ptr<T, P0, P1, P2, P3, P4, P5, P6, P7, P8, P9>, U, 0u>
|
||||
{ typedef Ptr<U, P0, P1, P2, P3, P4, P5, P6, P7, P8, P9> type; };
|
||||
|
||||
#endif //!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
} //namespace detail {
|
||||
} //namespace intrusive {
|
||||
} //namespace boost {
|
||||
|
@@ -73,6 +73,23 @@ struct remove_reference<T&>
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct remove_pointer
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct remove_pointer<T*>
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct add_pointer
|
||||
{
|
||||
typedef T *type;
|
||||
};
|
||||
|
||||
typedef char one;
|
||||
struct two {one _[2];};
|
||||
@@ -389,6 +406,63 @@ struct ls_zeros<1>
|
||||
static const std::size_t value = 0;
|
||||
};
|
||||
|
||||
template <typename T> struct unvoid_ref { typedef T &type; };
|
||||
template <> struct unvoid_ref<void> { struct type_impl { }; typedef type_impl & type; };
|
||||
template <> struct unvoid_ref<const void> { struct type_impl { }; typedef type_impl & type; };
|
||||
|
||||
// Infrastructure for providing a default type for T::TNAME if absent.
|
||||
#define BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(TNAME) \
|
||||
template <typename T, typename DefaultType> \
|
||||
struct boost_intrusive_default_type_ ## TNAME \
|
||||
{ \
|
||||
template <typename X> \
|
||||
static char test(int, typename X::TNAME*); \
|
||||
\
|
||||
template <typename X> \
|
||||
static int test(...); \
|
||||
\
|
||||
struct DefaultWrap { typedef DefaultType TNAME; }; \
|
||||
\
|
||||
static const bool value = (1 == sizeof(test<T>(0, 0))); \
|
||||
\
|
||||
typedef typename \
|
||||
::boost::intrusive::detail::if_c \
|
||||
<value, T, DefaultWrap>::type::TNAME type; \
|
||||
}; \
|
||||
\
|
||||
template <typename T, typename DefaultType> \
|
||||
struct boost_intrusive_eval_default_type_ ## TNAME \
|
||||
{ \
|
||||
template <typename X> \
|
||||
static char test(int, typename X::TNAME*); \
|
||||
\
|
||||
template <typename X> \
|
||||
static int test(...); \
|
||||
\
|
||||
struct DefaultWrap \
|
||||
{ typedef typename DefaultType::type TNAME; }; \
|
||||
\
|
||||
static const bool value = (1 == sizeof(test<T>(0, 0))); \
|
||||
\
|
||||
typedef typename \
|
||||
::boost::intrusive::detail::eval_if_c \
|
||||
< value \
|
||||
, ::boost::intrusive::detail::identity<T> \
|
||||
, ::boost::intrusive::detail::identity<DefaultWrap> \
|
||||
>::type::TNAME type; \
|
||||
}; \
|
||||
//
|
||||
|
||||
#define BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(INSTANTIATION_NS_PREFIX, T, TNAME, TIMPL) \
|
||||
typename INSTANTIATION_NS_PREFIX \
|
||||
boost_intrusive_default_type_ ## TNAME< T, TIMPL >::type \
|
||||
//
|
||||
|
||||
#define BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(INSTANTIATION_NS_PREFIX, T, TNAME, TIMPL) \
|
||||
typename INSTANTIATION_NS_PREFIX \
|
||||
boost_intrusive_eval_default_type_ ## TNAME< T, TIMPL >::type \
|
||||
//
|
||||
|
||||
} //namespace detail
|
||||
} //namespace intrusive
|
||||
} //namespace boost
|
||||
|
170
include/boost/intrusive/detail/pointer_element.hpp
Normal file
170
include/boost/intrusive/detail/pointer_element.hpp
Normal file
@@ -0,0 +1,170 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2014-2014. 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_POINTER_ELEMENT_HPP
|
||||
#define BOOST_INTRUSIVE_DETAIL_POINTER_ELEMENT_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/intrusive/detail/workaround.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
namespace detail{
|
||||
|
||||
//////////////////////
|
||||
//struct first_param
|
||||
//////////////////////
|
||||
|
||||
template <typename T> struct first_param
|
||||
{ typedef void type; };
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
template <template <typename, typename...> class TemplateClass, typename T, typename... Args>
|
||||
struct first_param< TemplateClass<T, Args...> >
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
#else //C++03 compilers
|
||||
|
||||
template < template //0arg
|
||||
<class
|
||||
> class TemplateClass, class T
|
||||
>
|
||||
struct first_param
|
||||
< TemplateClass<T> >
|
||||
{ typedef T type; };
|
||||
|
||||
template < template //1arg
|
||||
<class,class
|
||||
> class TemplateClass, class T
|
||||
, class P0>
|
||||
struct first_param
|
||||
< TemplateClass<T, P0> >
|
||||
{ typedef T type; };
|
||||
|
||||
template < template //2arg
|
||||
<class,class,class
|
||||
> class TemplateClass, class T
|
||||
, class P0, class P1>
|
||||
struct first_param
|
||||
< TemplateClass<T, P0, P1> >
|
||||
{ typedef T type; };
|
||||
|
||||
template < template //3arg
|
||||
<class,class,class,class
|
||||
> class TemplateClass, class T
|
||||
, class P0, class P1, class P2>
|
||||
struct first_param
|
||||
< TemplateClass<T, P0, P1, P2> >
|
||||
{ typedef T type; };
|
||||
|
||||
template < template //4arg
|
||||
<class,class,class,class,class
|
||||
> class TemplateClass, class T
|
||||
, class P0, class P1, class P2, class P3>
|
||||
struct first_param
|
||||
< TemplateClass<T, P0, P1, P2, P3> >
|
||||
{ typedef T type; };
|
||||
|
||||
template < template //5arg
|
||||
<class,class,class,class,class,class
|
||||
> class TemplateClass, class T
|
||||
, class P0, class P1, class P2, class P3, class P4>
|
||||
struct first_param
|
||||
< TemplateClass<T, P0, P1, P2, P3, P4> >
|
||||
{ typedef T type; };
|
||||
|
||||
template < template //6arg
|
||||
<class,class,class,class,class,class,class
|
||||
> class TemplateClass, class T
|
||||
, class P0, class P1, class P2, class P3, class P4, class P5>
|
||||
struct first_param
|
||||
< TemplateClass<T, P0, P1, P2, P3, P4, P5> >
|
||||
{ typedef T type; };
|
||||
|
||||
template < template //7arg
|
||||
<class,class,class,class,class,class,class,class
|
||||
> class TemplateClass, class T
|
||||
, class P0, class P1, class P2, class P3, class P4, class P5, class P6>
|
||||
struct first_param
|
||||
< TemplateClass<T, P0, P1, P2, P3, P4, P5, P6> >
|
||||
{ typedef T type; };
|
||||
|
||||
template < template //8arg
|
||||
<class,class,class,class,class,class,class,class,class
|
||||
> class TemplateClass, class T
|
||||
, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7>
|
||||
struct first_param
|
||||
< TemplateClass<T, P0, P1, P2, P3, P4, P5, P6, P7> >
|
||||
{ typedef T type; };
|
||||
|
||||
template < template //9arg
|
||||
<class,class,class,class,class,class,class,class,class,class
|
||||
> class TemplateClass, class T
|
||||
, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8>
|
||||
struct first_param
|
||||
< TemplateClass<T, P0, P1, P2, P3, P4, P5, P6, P7, P8> >
|
||||
{ typedef T type; };
|
||||
|
||||
template < template //10arg
|
||||
<class,class,class,class,class,class,class,class,class,class,class
|
||||
> class TemplateClass, class T
|
||||
, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9>
|
||||
struct first_param
|
||||
< TemplateClass<T, P0, P1, P2, P3, P4, P5, P6, P7, P8, P9> >
|
||||
{ typedef T type; };
|
||||
|
||||
#endif //!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
template <typename T>
|
||||
struct has_internal_pointer_element
|
||||
{
|
||||
template <typename X>
|
||||
static char test(int, typename X::element_type*);
|
||||
|
||||
template <typename X>
|
||||
static int test(...);
|
||||
|
||||
static const bool value = (1 == sizeof(test<T>(0, 0)));
|
||||
};
|
||||
|
||||
template<class Ptr, bool = has_internal_pointer_element<Ptr>::value>
|
||||
struct pointer_element_impl
|
||||
{
|
||||
typedef typename Ptr::element_type type;
|
||||
};
|
||||
|
||||
template<class Ptr>
|
||||
struct pointer_element_impl<Ptr, false>
|
||||
{
|
||||
typedef typename boost::intrusive::detail::first_param<Ptr>::type type;
|
||||
};
|
||||
|
||||
} //namespace detail{
|
||||
|
||||
template <typename Ptr>
|
||||
struct pointer_element
|
||||
{
|
||||
typedef typename ::boost::intrusive::detail::pointer_element_impl<Ptr>::type type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct pointer_element<T*>
|
||||
{ typedef T type; };
|
||||
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
#endif // defined(BOOST_INTRUSIVE_DETAIL_POINTER_ELEMENT_HPP)
|
@@ -15,8 +15,7 @@
|
||||
#define BOOST_INTRUSIVE_RBTREE_NODE_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <iterator>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/intrusive/pointer_rebind.hpp>
|
||||
#include <boost/intrusive/rbtree_algorithms.hpp>
|
||||
#include <boost/intrusive/pointer_plus_bits.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
@@ -36,9 +35,9 @@ namespace intrusive {
|
||||
template<class VoidPointer>
|
||||
struct compact_rbtree_node
|
||||
{
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>::template rebind_pointer
|
||||
<compact_rbtree_node<VoidPointer> >::type node_ptr;
|
||||
typedef compact_rbtree_node<VoidPointer> node;
|
||||
typedef typename pointer_rebind<VoidPointer, node >::type node_ptr;
|
||||
typedef typename pointer_rebind<VoidPointer, const node >::type const_node_ptr;
|
||||
enum color { red_t, black_t };
|
||||
node_ptr parent_, left_, right_;
|
||||
};
|
||||
@@ -47,9 +46,9 @@ struct compact_rbtree_node
|
||||
template<class VoidPointer>
|
||||
struct rbtree_node
|
||||
{
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>::template rebind_pointer
|
||||
<rbtree_node<VoidPointer> >::type node_ptr;
|
||||
typedef rbtree_node<VoidPointer> node;
|
||||
typedef typename pointer_rebind<VoidPointer, node >::type node_ptr;
|
||||
typedef typename pointer_rebind<VoidPointer, const node >::type const_node_ptr;
|
||||
|
||||
enum color { red_t, black_t };
|
||||
node_ptr parent_, left_, right_;
|
||||
@@ -62,11 +61,8 @@ template<class VoidPointer>
|
||||
struct default_rbtree_node_traits_impl
|
||||
{
|
||||
typedef rbtree_node<VoidPointer> node;
|
||||
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>::template rebind_pointer<node>::type node_ptr;
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>::template rebind_pointer<const node>::type const_node_ptr;
|
||||
typedef typename node::node_ptr node_ptr;
|
||||
typedef typename node::const_node_ptr const_node_ptr;
|
||||
|
||||
typedef typename node::color color;
|
||||
|
||||
@@ -119,10 +115,8 @@ template<class VoidPointer>
|
||||
struct compact_rbtree_node_traits_impl
|
||||
{
|
||||
typedef compact_rbtree_node<VoidPointer> node;
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>::template rebind_pointer<node>::type node_ptr;
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>::template rebind_pointer<const node>::type const_node_ptr;
|
||||
typedef typename node::node_ptr node_ptr;
|
||||
typedef typename node::const_node_ptr const_node_ptr;
|
||||
|
||||
typedef pointer_plus_bits<node_ptr, 1> ptr_bit;
|
||||
|
||||
|
@@ -14,7 +14,7 @@
|
||||
#define BOOST_INTRUSIVE_DETAIL_ITERATOR_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <iterator>
|
||||
#include <boost/intrusive/detail/iiterator.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
@@ -24,11 +24,11 @@ template<class It>
|
||||
class reverse_iterator
|
||||
{
|
||||
public:
|
||||
typedef typename std::iterator_traits<It>::pointer pointer;
|
||||
typedef typename std::iterator_traits<It>::reference reference;
|
||||
typedef typename std::iterator_traits<It>::difference_type difference_type;
|
||||
typedef typename std::iterator_traits<It>::iterator_category iterator_category;
|
||||
typedef typename std::iterator_traits<It>::value_type value_type;
|
||||
typedef typename boost::intrusive::iterator_traits<It>::pointer pointer;
|
||||
typedef typename boost::intrusive::iterator_traits<It>::reference reference;
|
||||
typedef typename boost::intrusive::iterator_traits<It>::difference_type difference_type;
|
||||
typedef typename boost::intrusive::iterator_traits<It>::iterator_category iterator_category;
|
||||
typedef typename boost::intrusive::iterator_traits<It>::value_type value_type;
|
||||
|
||||
|
||||
typedef It iterator_type;
|
||||
|
116
include/boost/intrusive/detail/slist_iterator.hpp
Normal file
116
include/boost/intrusive/detail/slist_iterator.hpp
Normal file
@@ -0,0 +1,116 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||
//
|
||||
// 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_ITERATOR_HPP
|
||||
#define BOOST_INTRUSIVE_SLIST_ITERATOR_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <boost/intrusive/detail/std_fwd.hpp>
|
||||
#include <boost/intrusive/detail/iiterator.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
||||
|
||||
// slist_iterator provides some basic functions for a
|
||||
// node oriented bidirectional iterator:
|
||||
template<class ValueTraits, bool IsConst>
|
||||
class slist_iterator
|
||||
{
|
||||
protected:
|
||||
typedef iiterator
|
||||
<ValueTraits, IsConst, std::forward_iterator_tag> types_t;
|
||||
|
||||
static const bool stateful_value_traits = types_t::stateful_value_traits;
|
||||
|
||||
typedef ValueTraits value_traits;
|
||||
typedef typename types_t::node_traits node_traits;
|
||||
|
||||
typedef typename types_t::node node;
|
||||
typedef typename types_t::node_ptr node_ptr;
|
||||
typedef typename types_t::const_value_traits_ptr const_value_traits_ptr;
|
||||
|
||||
public:
|
||||
typedef typename types_t::iterator_traits::difference_type difference_type;
|
||||
typedef typename types_t::iterator_traits::value_type value_type;
|
||||
typedef typename types_t::iterator_traits::pointer pointer;
|
||||
typedef typename types_t::iterator_traits::reference reference;
|
||||
typedef typename types_t::iterator_traits::iterator_category iterator_category;
|
||||
|
||||
slist_iterator()
|
||||
{}
|
||||
|
||||
explicit slist_iterator(const node_ptr & nodeptr, const const_value_traits_ptr &traits_ptr)
|
||||
: members_(nodeptr, traits_ptr)
|
||||
{}
|
||||
|
||||
slist_iterator(slist_iterator<ValueTraits, false> const& other)
|
||||
: members_(other.pointed_node(), other.get_value_traits())
|
||||
{}
|
||||
|
||||
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); }
|
||||
|
||||
const_value_traits_ptr get_value_traits() const
|
||||
{ return members_.get_ptr(); }
|
||||
|
||||
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 this->operator_arrow(detail::bool_<stateful_value_traits>()); }
|
||||
|
||||
slist_iterator<ValueTraits, false> unconst() const
|
||||
{ return slist_iterator<ValueTraits, false>(this->pointed_node(), this->get_value_traits()); }
|
||||
|
||||
private:
|
||||
|
||||
pointer operator_arrow(detail::false_) const
|
||||
{ return ValueTraits::to_value_ptr(members_.nodeptr_); }
|
||||
|
||||
pointer operator_arrow(detail::true_) const
|
||||
{ return this->get_value_traits()->to_value_ptr(members_.nodeptr_); }
|
||||
|
||||
iiterator_members<node_ptr, const_value_traits_ptr, stateful_value_traits> members_;
|
||||
};
|
||||
|
||||
} //namespace intrusive
|
||||
} //namespace boost
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
#endif //BOOST_INTRUSIVE_SLIST_ITERATOR_HPP
|
@@ -15,9 +15,7 @@
|
||||
#define BOOST_INTRUSIVE_SLIST_NODE_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <boost/intrusive/detail/utilities.hpp>
|
||||
#include <boost/intrusive/detail/assert.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/intrusive/pointer_rebind.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
@@ -25,8 +23,7 @@ namespace intrusive {
|
||||
template<class VoidPointer>
|
||||
struct slist_node
|
||||
{
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>::template rebind_pointer<slist_node>::type node_ptr;
|
||||
typedef typename pointer_rebind<VoidPointer, slist_node>::type node_ptr;
|
||||
node_ptr next_;
|
||||
};
|
||||
|
||||
@@ -36,11 +33,9 @@ struct slist_node
|
||||
template<class VoidPointer>
|
||||
struct slist_node_traits
|
||||
{
|
||||
typedef slist_node<VoidPointer> node;
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>::template rebind_pointer<node>::type node_ptr;
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>::template rebind_pointer<const node>::type const_node_ptr;
|
||||
typedef slist_node<VoidPointer> node;
|
||||
typedef typename node::node_ptr node_ptr;
|
||||
typedef typename pointer_rebind<VoidPointer, const node>::type const_node_ptr;
|
||||
|
||||
static node_ptr get_next(const const_node_ptr & n)
|
||||
{ return n->next_; }
|
||||
@@ -52,91 +47,6 @@ struct slist_node_traits
|
||||
{ n->next_ = next; }
|
||||
};
|
||||
|
||||
// slist_iterator provides some basic functions for a
|
||||
// node oriented bidirectional iterator:
|
||||
template<class ValueTraits, bool IsConst>
|
||||
class slist_iterator
|
||||
{
|
||||
protected:
|
||||
typedef iiterator
|
||||
<ValueTraits, IsConst, std::forward_iterator_tag> types_t;
|
||||
|
||||
static const bool stateful_value_traits = types_t::stateful_value_traits;
|
||||
|
||||
typedef ValueTraits value_traits;
|
||||
typedef typename types_t::node_traits node_traits;
|
||||
|
||||
typedef typename types_t::node node;
|
||||
typedef typename types_t::node_ptr node_ptr;
|
||||
typedef typename types_t::const_value_traits_ptr const_value_traits_ptr;
|
||||
|
||||
public:
|
||||
typedef typename types_t::iterator_traits::difference_type difference_type;
|
||||
typedef typename types_t::iterator_traits::value_type value_type;
|
||||
typedef typename types_t::iterator_traits::pointer pointer;
|
||||
typedef typename types_t::iterator_traits::reference reference;
|
||||
typedef typename types_t::iterator_traits::iterator_category iterator_category;
|
||||
|
||||
slist_iterator()
|
||||
{}
|
||||
|
||||
explicit slist_iterator(const node_ptr & nodeptr, const const_value_traits_ptr &traits_ptr)
|
||||
: members_(nodeptr, traits_ptr)
|
||||
{}
|
||||
|
||||
slist_iterator(slist_iterator<ValueTraits, false> const& other)
|
||||
: members_(other.pointed_node(), other.get_value_traits())
|
||||
{}
|
||||
|
||||
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); }
|
||||
|
||||
const_value_traits_ptr get_value_traits() const
|
||||
{ return members_.get_ptr(); }
|
||||
|
||||
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 this->operator_arrow(detail::bool_<stateful_value_traits>()); }
|
||||
|
||||
slist_iterator<ValueTraits, false> unconst() const
|
||||
{ return slist_iterator<ValueTraits, false>(this->pointed_node(), this->get_value_traits()); }
|
||||
|
||||
private:
|
||||
|
||||
pointer operator_arrow(detail::false_) const
|
||||
{ return ValueTraits::to_value_ptr(members_.nodeptr_); }
|
||||
|
||||
pointer operator_arrow(detail::true_) const
|
||||
{ return this->get_value_traits()->to_value_ptr(members_.nodeptr_); }
|
||||
|
||||
iiterator_members<node_ptr, const_value_traits_ptr, stateful_value_traits> members_;
|
||||
};
|
||||
|
||||
} //namespace intrusive
|
||||
} //namespace boost
|
||||
|
||||
|
54
include/boost/intrusive/detail/std_fwd.hpp
Normal file
54
include/boost/intrusive/detail/std_fwd.hpp
Normal file
@@ -0,0 +1,54 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2014-2014. 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/container for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_DETAIL_STD_FWD_HPP
|
||||
#define BOOST_INTRUSIVE_DETAIL_STD_FWD_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Standard predeclarations
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if defined(__clang__) && defined(_LIBCPP_VERSION)
|
||||
#define BOOST_INTRUSIVE_CLANG_INLINE_STD_NS
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wc++11-extensions"
|
||||
#define BOOST_INTRUSIVE_STD_NS_BEG _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
#define BOOST_INTRUSIVE_STD_NS_END _LIBCPP_END_NAMESPACE_STD
|
||||
#else
|
||||
#define BOOST_INTRUSIVE_STD_NS_BEG namespace std{
|
||||
#define BOOST_INTRUSIVE_STD_NS_END }
|
||||
#endif
|
||||
|
||||
BOOST_INTRUSIVE_STD_NS_BEG
|
||||
|
||||
template<class T>
|
||||
struct less;
|
||||
|
||||
template<class T>
|
||||
struct equal_to;
|
||||
|
||||
struct input_iterator_tag;
|
||||
struct forward_iterator_tag;
|
||||
struct bidirectional_iterator_tag;
|
||||
struct random_access_iterator_tag;
|
||||
|
||||
BOOST_INTRUSIVE_STD_NS_END
|
||||
|
||||
#ifdef BOOST_INTRUSIVE_CLANG_INLINE_STD_NS
|
||||
#pragma GCC diagnostic pop
|
||||
#undef BOOST_INTRUSIVE_CLANG_INLINE_STD_NS
|
||||
#endif //BOOST_INTRUSIVE_CLANG_INLINE_STD_NS
|
||||
|
||||
#endif //#ifndef BOOST_INTRUSIVE_DETAIL_STD_FWD_HPP
|
||||
|
@@ -14,7 +14,7 @@
|
||||
#define BOOST_INTRUSIVE_DETAIL_TO_RAW_POINTER_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/intrusive/detail/pointer_element.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
@@ -25,7 +25,7 @@ inline T* to_raw_pointer(T* p)
|
||||
{ return p; }
|
||||
|
||||
template <class Pointer>
|
||||
inline typename boost::intrusive::pointer_traits<Pointer>::element_type*
|
||||
inline typename boost::intrusive::pointer_element<Pointer>::type*
|
||||
to_raw_pointer(const Pointer &p)
|
||||
{ return boost::intrusive::detail::to_raw_pointer(p.operator->()); }
|
||||
|
||||
|
@@ -14,7 +14,6 @@
|
||||
#define BOOST_INTRUSIVE_DETAIL_TRANSFORM_ITERATOR_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <iterator>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
|
||||
namespace boost {
|
||||
@@ -51,7 +50,7 @@ struct operator_arrow_proxy<T&>
|
||||
|
||||
template <class Iterator, class UnaryFunction>
|
||||
class transform_iterator
|
||||
: public std::iterator
|
||||
: public boost::intrusive::iterator
|
||||
< typename Iterator::iterator_category
|
||||
, typename detail::remove_reference<typename UnaryFunction::result_type>::type
|
||||
, typename Iterator::difference_type
|
||||
@@ -158,10 +157,10 @@ class transform_iterator
|
||||
{ return members_(*members_.m_it); }
|
||||
|
||||
void advance(typename Iterator::difference_type n)
|
||||
{ std::advance(members_.m_it, n); }
|
||||
{ boost::intrusive::iterator_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); }
|
||||
{ return boost::intrusive::iterator_distance(other.members_.m_it, members_.m_it); }
|
||||
};
|
||||
|
||||
} //namespace detail
|
||||
|
137
include/boost/intrusive/detail/tree_iterator.hpp
Normal file
137
include/boost/intrusive/detail/tree_iterator.hpp
Normal file
@@ -0,0 +1,137 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||
//
|
||||
// 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_ITERATOR_HPP
|
||||
#define BOOST_INTRUSIVE_TREE_ITERATOR_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <boost/intrusive/detail/std_fwd.hpp>
|
||||
#include <boost/intrusive/detail/iiterator.hpp>
|
||||
#include <boost/intrusive/bstree_algorithms.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// Implementation of the tree iterator //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// tree_iterator provides some basic functions for a
|
||||
// node oriented bidirectional iterator:
|
||||
template<class ValueTraits, bool IsConst>
|
||||
class tree_iterator
|
||||
{
|
||||
protected:
|
||||
typedef iiterator< ValueTraits, IsConst
|
||||
, std::bidirectional_iterator_tag> types_t;
|
||||
|
||||
typedef ValueTraits value_traits;
|
||||
typedef typename types_t::node_traits node_traits;
|
||||
|
||||
typedef typename types_t::node node;
|
||||
typedef typename types_t::node_ptr node_ptr;
|
||||
typedef typename types_t::const_value_traits_ptr const_value_traits_ptr;
|
||||
static const bool stateful_value_traits = types_t::stateful_value_traits;
|
||||
typedef bstree_algorithms<node_traits> node_algorithms;
|
||||
|
||||
public:
|
||||
typedef typename types_t::iterator_traits::difference_type difference_type;
|
||||
typedef typename types_t::iterator_traits::value_type value_type;
|
||||
typedef typename types_t::iterator_traits::pointer pointer;
|
||||
typedef typename types_t::iterator_traits::reference reference;
|
||||
typedef typename types_t::iterator_traits::iterator_category iterator_category;
|
||||
|
||||
tree_iterator()
|
||||
{}
|
||||
|
||||
explicit tree_iterator(const node_ptr & nodeptr, const const_value_traits_ptr &traits_ptr)
|
||||
: members_(nodeptr, traits_ptr)
|
||||
{}
|
||||
|
||||
tree_iterator(tree_iterator<value_traits, false> const& other)
|
||||
: members_(other.pointed_node(), other.get_value_traits())
|
||||
{}
|
||||
|
||||
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 this->operator_arrow(detail::bool_<stateful_value_traits>()); }
|
||||
|
||||
const_value_traits_ptr get_value_traits() const
|
||||
{ return members_.get_ptr(); }
|
||||
|
||||
tree_iterator end_iterator_from_it() const
|
||||
{
|
||||
return tree_iterator(node_algorithms::get_header(this->pointed_node()), this->get_value_traits());
|
||||
}
|
||||
|
||||
tree_iterator<value_traits, false> unconst() const
|
||||
{ return tree_iterator<value_traits, false>(this->pointed_node(), this->get_value_traits()); }
|
||||
|
||||
private:
|
||||
pointer operator_arrow(detail::false_) const
|
||||
{ return ValueTraits::to_value_ptr(members_.nodeptr_); }
|
||||
|
||||
pointer operator_arrow(detail::true_) const
|
||||
{ return this->get_value_traits()->to_value_ptr(members_.nodeptr_); }
|
||||
|
||||
iiterator_members<node_ptr, const_value_traits_ptr, stateful_value_traits> members_;
|
||||
};
|
||||
|
||||
} //namespace intrusive
|
||||
} //namespace boost
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
#endif //BOOST_INTRUSIVE_TREE_ITERATOR_HPP
|
@@ -14,12 +14,7 @@
|
||||
#define BOOST_INTRUSIVE_TREE_NODE_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <iterator>
|
||||
#include <boost/intrusive/detail/utilities.hpp>
|
||||
#include <boost/intrusive/options.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/intrusive/bstree_algorithms.hpp>
|
||||
#include <boost/intrusive/pointer_rebind.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
@@ -27,9 +22,7 @@ namespace intrusive {
|
||||
template<class VoidPointer>
|
||||
struct tree_node
|
||||
{
|
||||
typedef typename pointer_traits
|
||||
<VoidPointer>::template rebind_pointer
|
||||
<tree_node<VoidPointer> >::type node_ptr;
|
||||
typedef typename pointer_rebind<VoidPointer, tree_node>::type node_ptr;
|
||||
|
||||
node_ptr parent_, left_, right_;
|
||||
};
|
||||
@@ -39,10 +32,8 @@ struct tree_node_traits
|
||||
{
|
||||
typedef tree_node<VoidPointer> node;
|
||||
|
||||
typedef typename pointer_traits<VoidPointer>::template
|
||||
rebind_pointer<node>::type node_ptr;
|
||||
typedef typename pointer_traits<VoidPointer>::template
|
||||
rebind_pointer<const node>::type const_node_ptr;
|
||||
typedef typename node::node_ptr node_ptr;
|
||||
typedef typename pointer_rebind<VoidPointer, const node>::type const_node_ptr;
|
||||
|
||||
static node_ptr get_parent(const const_node_ptr & n)
|
||||
{ return n->parent_; }
|
||||
@@ -72,114 +63,6 @@ struct tree_node_traits
|
||||
{ n->right_ = r; }
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// Implementation of the tree iterator //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// tree_iterator provides some basic functions for a
|
||||
// node oriented bidirectional iterator:
|
||||
template<class ValueTraits, bool IsConst>
|
||||
class tree_iterator
|
||||
{
|
||||
protected:
|
||||
typedef iiterator< ValueTraits, IsConst
|
||||
, std::bidirectional_iterator_tag> types_t;
|
||||
|
||||
typedef ValueTraits value_traits;
|
||||
typedef typename types_t::node_traits node_traits;
|
||||
|
||||
typedef typename types_t::node node;
|
||||
typedef typename types_t::node_ptr node_ptr;
|
||||
typedef typename types_t::const_value_traits_ptr const_value_traits_ptr;
|
||||
static const bool stateful_value_traits = types_t::stateful_value_traits;
|
||||
typedef bstree_algorithms<node_traits> node_algorithms;
|
||||
|
||||
public:
|
||||
typedef typename types_t::iterator_traits::difference_type difference_type;
|
||||
typedef typename types_t::iterator_traits::value_type value_type;
|
||||
typedef typename types_t::iterator_traits::pointer pointer;
|
||||
typedef typename types_t::iterator_traits::reference reference;
|
||||
typedef typename types_t::iterator_traits::iterator_category iterator_category;
|
||||
|
||||
tree_iterator()
|
||||
{}
|
||||
|
||||
explicit tree_iterator(const node_ptr & nodeptr, const const_value_traits_ptr &traits_ptr)
|
||||
: members_(nodeptr, traits_ptr)
|
||||
{}
|
||||
|
||||
tree_iterator(tree_iterator<value_traits, false> const& other)
|
||||
: members_(other.pointed_node(), other.get_value_traits())
|
||||
{}
|
||||
|
||||
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 this->operator_arrow(detail::bool_<stateful_value_traits>()); }
|
||||
|
||||
const_value_traits_ptr get_value_traits() const
|
||||
{ return members_.get_ptr(); }
|
||||
|
||||
tree_iterator end_iterator_from_it() const
|
||||
{
|
||||
return tree_iterator(node_algorithms::get_header(this->pointed_node()), this->get_value_traits());
|
||||
}
|
||||
|
||||
tree_iterator<value_traits, false> unconst() const
|
||||
{ return tree_iterator<value_traits, false>(this->pointed_node(), this->get_value_traits()); }
|
||||
|
||||
private:
|
||||
pointer operator_arrow(detail::false_) const
|
||||
{ return ValueTraits::to_value_ptr(members_.nodeptr_); }
|
||||
|
||||
pointer operator_arrow(detail::true_) const
|
||||
{ return this->get_value_traits()->to_value_ptr(members_.nodeptr_); }
|
||||
|
||||
iiterator_members<node_ptr, const_value_traits_ptr, stateful_value_traits> members_;
|
||||
};
|
||||
|
||||
} //namespace intrusive
|
||||
} //namespace boost
|
||||
|
||||
|
@@ -21,14 +21,12 @@
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/intrusive/detail/assert.hpp>
|
||||
#include <boost/intrusive/detail/is_stateful_value_traits.hpp>
|
||||
#include <boost/intrusive/detail/memory_util.hpp>
|
||||
#include <boost/intrusive/detail/algo_type.hpp>
|
||||
#include <boost/intrusive/detail/to_raw_pointer.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <boost/intrusive/detail/std_fwd.hpp>
|
||||
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <cstddef>
|
||||
#include <iterator>
|
||||
#include <functional>
|
||||
|
||||
namespace boost {
|
||||
|
||||
@@ -741,92 +739,6 @@ struct fhtraits
|
||||
{ return const_hook_ptr(&*static_cast<const hook_type*>(&*n)); }
|
||||
};
|
||||
|
||||
template<class ValueTraits>
|
||||
struct value_traits_pointers
|
||||
{
|
||||
typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT
|
||||
(boost::intrusive::detail::
|
||||
, ValueTraits, value_traits_ptr
|
||||
, typename pointer_traits<typename ValueTraits::node_traits::node_ptr>::template
|
||||
rebind_pointer<ValueTraits>::type) value_traits_ptr;
|
||||
|
||||
typedef typename pointer_traits<value_traits_ptr>::template
|
||||
rebind_pointer<ValueTraits const>::type const_value_traits_ptr;
|
||||
};
|
||||
|
||||
template<class ValueTraits, bool IsConst, class Category>
|
||||
struct iiterator
|
||||
{
|
||||
typedef ValueTraits value_traits;
|
||||
typedef typename value_traits::node_traits node_traits;
|
||||
typedef typename node_traits::node node;
|
||||
typedef typename node_traits::node_ptr node_ptr;
|
||||
typedef ::boost::intrusive::pointer_traits<node_ptr> nodepointer_traits_t;
|
||||
typedef typename nodepointer_traits_t::template
|
||||
rebind_pointer<void>::type void_pointer;
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef typename ValueTraits::pointer nonconst_pointer;
|
||||
typedef typename ValueTraits::const_pointer yesconst_pointer;
|
||||
typedef typename ::boost::intrusive::pointer_traits
|
||||
<nonconst_pointer>::reference nonconst_reference;
|
||||
typedef typename ::boost::intrusive::pointer_traits
|
||||
<yesconst_pointer>::reference yesconst_reference;
|
||||
typedef typename nodepointer_traits_t::difference_type difference_type;
|
||||
typedef typename detail::if_c
|
||||
<IsConst, yesconst_pointer, nonconst_pointer>::type pointer;
|
||||
typedef typename detail::if_c
|
||||
<IsConst, yesconst_reference, nonconst_reference>::type reference;
|
||||
typedef std::iterator
|
||||
< Category
|
||||
, value_type
|
||||
, difference_type
|
||||
, pointer
|
||||
, reference
|
||||
> iterator_traits;
|
||||
typedef typename value_traits_pointers
|
||||
<ValueTraits>::value_traits_ptr value_traits_ptr;
|
||||
typedef typename value_traits_pointers
|
||||
<ValueTraits>::const_value_traits_ptr const_value_traits_ptr;
|
||||
static const bool stateful_value_traits =
|
||||
detail::is_stateful_value_traits<value_traits>::value;
|
||||
};
|
||||
|
||||
template<class NodePtr, class StoredPointer, bool StatefulValueTraits = true>
|
||||
struct iiterator_members
|
||||
{
|
||||
|
||||
iiterator_members()
|
||||
: nodeptr_()//Value initialization to achieve "null iterators" (N3644)
|
||||
{}
|
||||
|
||||
iiterator_members(const NodePtr &n_ptr, const StoredPointer &data)
|
||||
: nodeptr_(n_ptr), ptr_(data)
|
||||
{}
|
||||
|
||||
StoredPointer get_ptr() const
|
||||
{ return ptr_; }
|
||||
|
||||
NodePtr nodeptr_;
|
||||
StoredPointer ptr_;
|
||||
};
|
||||
|
||||
template<class NodePtr, class StoredPointer>
|
||||
struct iiterator_members<NodePtr, StoredPointer, false>
|
||||
{
|
||||
iiterator_members()
|
||||
: nodeptr_()//Value initialization to achieve "null iterators" (N3644)
|
||||
{}
|
||||
|
||||
iiterator_members(const NodePtr &n_ptr, const StoredPointer &)
|
||||
: nodeptr_(n_ptr)
|
||||
{}
|
||||
|
||||
StoredPointer get_ptr() const
|
||||
{ return StoredPointer(); }
|
||||
|
||||
NodePtr nodeptr_;
|
||||
};
|
||||
|
||||
template<class Less, class T>
|
||||
struct get_less
|
||||
{
|
||||
|
@@ -11,7 +11,9 @@
|
||||
#ifndef BOOST_INTRUSIVE_DETAIL_WRKRND_HPP
|
||||
#define BOOST_INTRUSIVE_DETAIL_WRKRND_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#ifndef BOOST_CONFIG_HPP
|
||||
#include <boost/config.hpp>
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
#define BOOST_INTRUSIVE_PERFECT_FORWARDING
|
||||
@@ -21,6 +23,4 @@
|
||||
#define BOOST_INTRUSIVE_IMPDEF(TYPE) TYPE
|
||||
#define BOOST_INTRUSIVE_SEEDOC(TYPE) TYPE
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
#endif //#ifndef BOOST_INTRUSIVE_DETAIL_WRKRND_HPP
|
||||
|
@@ -29,6 +29,7 @@
|
||||
#include <boost/intrusive/link_mode.hpp>
|
||||
#include <boost/intrusive/detail/ebo_functor_holder.hpp>
|
||||
#include <boost/intrusive/detail/utilities.hpp>
|
||||
#include <boost/intrusive/detail/is_stateful_value_traits.hpp>
|
||||
//Implementation utilities
|
||||
#include <boost/intrusive/unordered_set_hook.hpp>
|
||||
#include <boost/intrusive/slist.hpp>
|
||||
@@ -41,6 +42,71 @@ namespace intrusive {
|
||||
|
||||
/// @cond
|
||||
|
||||
template<int Dummy = 0>
|
||||
struct prime_list_holder
|
||||
{
|
||||
static const std::size_t prime_list[];
|
||||
static const std::size_t prime_list_size;
|
||||
};
|
||||
|
||||
//We only support LLP64(Win64) or LP64(most Unix) data models
|
||||
#ifdef _WIN64 //In 64 bit windows sizeof(size_t) == sizeof(unsigned long long)
|
||||
#define BOOST_INTRUSIVE_PRIME_C(NUMBER) NUMBER##ULL
|
||||
#define BOOST_INTRUSIVE_64_BIT_SIZE_T 1
|
||||
#else //In 32 bit windows and 32/64 bit unixes sizeof(size_t) == sizeof(unsigned long)
|
||||
#define BOOST_INTRUSIVE_PRIME_C(NUMBER) NUMBER##UL
|
||||
#define BOOST_INTRUSIVE_64_BIT_SIZE_T (((((ULONG_MAX>>16)>>16)>>16)>>15) != 0)
|
||||
#endif
|
||||
|
||||
template<int Dummy>
|
||||
const std::size_t prime_list_holder<Dummy>::prime_list[] = {
|
||||
BOOST_INTRUSIVE_PRIME_C(3), BOOST_INTRUSIVE_PRIME_C(7),
|
||||
BOOST_INTRUSIVE_PRIME_C(11), BOOST_INTRUSIVE_PRIME_C(17),
|
||||
BOOST_INTRUSIVE_PRIME_C(29), BOOST_INTRUSIVE_PRIME_C(53),
|
||||
BOOST_INTRUSIVE_PRIME_C(97), BOOST_INTRUSIVE_PRIME_C(193),
|
||||
BOOST_INTRUSIVE_PRIME_C(389), BOOST_INTRUSIVE_PRIME_C(769),
|
||||
BOOST_INTRUSIVE_PRIME_C(1543), BOOST_INTRUSIVE_PRIME_C(3079),
|
||||
BOOST_INTRUSIVE_PRIME_C(6151), BOOST_INTRUSIVE_PRIME_C(12289),
|
||||
BOOST_INTRUSIVE_PRIME_C(24593), BOOST_INTRUSIVE_PRIME_C(49157),
|
||||
BOOST_INTRUSIVE_PRIME_C(98317), BOOST_INTRUSIVE_PRIME_C(196613),
|
||||
BOOST_INTRUSIVE_PRIME_C(393241), BOOST_INTRUSIVE_PRIME_C(786433),
|
||||
BOOST_INTRUSIVE_PRIME_C(1572869), BOOST_INTRUSIVE_PRIME_C(3145739),
|
||||
BOOST_INTRUSIVE_PRIME_C(6291469), BOOST_INTRUSIVE_PRIME_C(12582917),
|
||||
BOOST_INTRUSIVE_PRIME_C(25165843), BOOST_INTRUSIVE_PRIME_C(50331653),
|
||||
BOOST_INTRUSIVE_PRIME_C(100663319), BOOST_INTRUSIVE_PRIME_C(201326611),
|
||||
BOOST_INTRUSIVE_PRIME_C(402653189), BOOST_INTRUSIVE_PRIME_C(805306457),
|
||||
BOOST_INTRUSIVE_PRIME_C(1610612741), BOOST_INTRUSIVE_PRIME_C(3221225473),
|
||||
#if BOOST_INTRUSIVE_64_BIT_SIZE_T
|
||||
//Taken from Boost.MultiIndex code, thanks to Joaquin M Lopez Munoz.
|
||||
BOOST_INTRUSIVE_PRIME_C(6442450939), BOOST_INTRUSIVE_PRIME_C(12884901893),
|
||||
BOOST_INTRUSIVE_PRIME_C(25769803751), BOOST_INTRUSIVE_PRIME_C(51539607551),
|
||||
BOOST_INTRUSIVE_PRIME_C(103079215111), BOOST_INTRUSIVE_PRIME_C(206158430209),
|
||||
BOOST_INTRUSIVE_PRIME_C(412316860441), BOOST_INTRUSIVE_PRIME_C(824633720831),
|
||||
BOOST_INTRUSIVE_PRIME_C(1649267441651), BOOST_INTRUSIVE_PRIME_C(3298534883309),
|
||||
BOOST_INTRUSIVE_PRIME_C(6597069766657), BOOST_INTRUSIVE_PRIME_C(13194139533299),
|
||||
BOOST_INTRUSIVE_PRIME_C(26388279066623), BOOST_INTRUSIVE_PRIME_C(52776558133303),
|
||||
BOOST_INTRUSIVE_PRIME_C(105553116266489), BOOST_INTRUSIVE_PRIME_C(211106232532969),
|
||||
BOOST_INTRUSIVE_PRIME_C(422212465066001), BOOST_INTRUSIVE_PRIME_C(844424930131963),
|
||||
BOOST_INTRUSIVE_PRIME_C(1688849860263953), BOOST_INTRUSIVE_PRIME_C(3377699720527861),
|
||||
BOOST_INTRUSIVE_PRIME_C(6755399441055731), BOOST_INTRUSIVE_PRIME_C(13510798882111483),
|
||||
BOOST_INTRUSIVE_PRIME_C(27021597764222939), BOOST_INTRUSIVE_PRIME_C(54043195528445957),
|
||||
BOOST_INTRUSIVE_PRIME_C(108086391056891903), BOOST_INTRUSIVE_PRIME_C(216172782113783843),
|
||||
BOOST_INTRUSIVE_PRIME_C(432345564227567621), BOOST_INTRUSIVE_PRIME_C(864691128455135207),
|
||||
BOOST_INTRUSIVE_PRIME_C(1729382256910270481), BOOST_INTRUSIVE_PRIME_C(3458764513820540933),
|
||||
BOOST_INTRUSIVE_PRIME_C(6917529027641081903), BOOST_INTRUSIVE_PRIME_C(13835058055282163729),
|
||||
BOOST_INTRUSIVE_PRIME_C(18446744073709551557)
|
||||
#else
|
||||
BOOST_INTRUSIVE_PRIME_C(4294967291)
|
||||
#endif
|
||||
};
|
||||
|
||||
#undef BOOST_INTRUSIVE_PRIME_C
|
||||
#undef BOOST_INTRUSIVE_64_BIT_SIZE_T
|
||||
|
||||
template<int Dummy>
|
||||
const std::size_t prime_list_holder<Dummy>::prime_list_size
|
||||
= sizeof(prime_list)/sizeof(std::size_t);
|
||||
|
||||
struct hash_bool_flags
|
||||
{
|
||||
static const std::size_t unique_keys_pos = 1u;
|
||||
@@ -2634,8 +2700,8 @@ class hashtable_impl
|
||||
//! <b>Throws</b>: Nothing.
|
||||
static size_type suggested_upper_bucket_count(size_type n)
|
||||
{
|
||||
const std::size_t *primes = &detail::prime_list_holder<0>::prime_list[0];
|
||||
const std::size_t *primes_end = primes + detail::prime_list_holder<0>::prime_list_size;
|
||||
const std::size_t *primes = &prime_list_holder<0>::prime_list[0];
|
||||
const std::size_t *primes_end = primes + prime_list_holder<0>::prime_list_size;
|
||||
std::size_t const* bound = std::lower_bound(primes, primes_end, n);
|
||||
bound -= (bound == primes_end);
|
||||
return size_type(*bound);
|
||||
@@ -2652,8 +2718,8 @@ class hashtable_impl
|
||||
//! <b>Throws</b>: Nothing.
|
||||
static size_type suggested_lower_bucket_count(size_type n)
|
||||
{
|
||||
const std::size_t *primes = &detail::prime_list_holder<0>::prime_list[0];
|
||||
const std::size_t *primes_end = primes + detail::prime_list_holder<0>::prime_list_size;
|
||||
const std::size_t *primes = &prime_list_holder<0>::prime_list[0];
|
||||
const std::size_t *primes_end = primes + prime_list_holder<0>::prime_list_size;
|
||||
size_type const* bound = std::upper_bound(primes, primes_end, n);
|
||||
bound -= (bound != primes);
|
||||
return size_type(*bound);
|
||||
|
@@ -24,10 +24,12 @@
|
||||
#include <boost/intrusive/link_mode.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/intrusive/options.hpp>
|
||||
#include <boost/intrusive/detail/is_stateful_value_traits.hpp>
|
||||
#include <boost/intrusive/detail/utilities.hpp>
|
||||
#include <boost/intrusive/detail/default_header_holder.hpp>
|
||||
#include <boost/intrusive/detail/reverse_iterator.hpp>
|
||||
#include <boost/intrusive/detail/uncast.hpp>
|
||||
#include <boost/intrusive/detail/list_iterator.hpp>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <cstddef>
|
||||
|
@@ -17,7 +17,6 @@
|
||||
#include <boost/intrusive/intrusive_fwd.hpp>
|
||||
|
||||
#include <boost/intrusive/link_mode.hpp>
|
||||
#include <iterator>
|
||||
#include <boost/intrusive/detail/parent_from_member.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
|
||||
@@ -42,6 +41,7 @@ struct member_value_traits
|
||||
typedef typename node_traits::node node;
|
||||
typedef typename node_traits::node_ptr node_ptr;
|
||||
typedef typename node_traits::const_node_ptr const_node_ptr;
|
||||
typedef pointer_traits<node_ptr> node_ptr_traits;
|
||||
typedef typename pointer_traits<node_ptr>::template
|
||||
rebind_pointer<T>::type pointer;
|
||||
typedef typename pointer_traits<node_ptr>::template
|
||||
@@ -53,21 +53,22 @@ struct member_value_traits
|
||||
static const link_mode_type link_mode = LinkMode;
|
||||
|
||||
static node_ptr to_node_ptr(reference value)
|
||||
{ return node_ptr(&(value.*PtrToMember)); }
|
||||
{ return pointer_traits<node_ptr>::pointer_to(value.*PtrToMember); }
|
||||
|
||||
static const_node_ptr to_node_ptr(const_reference value)
|
||||
{ return node_ptr(&(value.*PtrToMember)); }
|
||||
{ return pointer_traits<const_node_ptr>::pointer_to(value.*PtrToMember); }
|
||||
|
||||
static pointer to_value_ptr(const node_ptr &n)
|
||||
{
|
||||
return pointer(detail::parent_from_member<value_type, node>
|
||||
return pointer_traits<pointer>::pointer_to(*detail::parent_from_member<value_type, node>
|
||||
(boost::intrusive::detail::to_raw_pointer(n), PtrToMember));
|
||||
}
|
||||
|
||||
static const_pointer to_value_ptr(const const_node_ptr &n)
|
||||
{
|
||||
return pointer(detail::parent_from_member<value_type, node>
|
||||
return pointer_traits<const_pointer>::pointer_to(*detail::parent_from_member<value_type, node>
|
||||
(boost::intrusive::detail::to_raw_pointer(n), PtrToMember));
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
188
include/boost/intrusive/pointer_rebind.hpp
Normal file
188
include/boost/intrusive/pointer_rebind.hpp
Normal file
@@ -0,0 +1,188 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2014-2014. 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_REBIND_HPP
|
||||
#define BOOST_INTRUSIVE_POINTER_REBIND_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/intrusive/detail/workaround.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
||||
///////////////////////////
|
||||
//struct pointer_rebind_mode
|
||||
///////////////////////////
|
||||
template <typename Ptr, typename U>
|
||||
struct pointer_has_rebind
|
||||
{
|
||||
template <typename V> struct any
|
||||
{ any(const V&) { } };
|
||||
|
||||
template <typename X>
|
||||
static char test(int, typename X::template rebind<U>*);
|
||||
|
||||
template <typename X>
|
||||
static int test(any<int>, void*);
|
||||
|
||||
static const bool value = (1 == sizeof(test<Ptr>(0, 0)));
|
||||
};
|
||||
|
||||
template <typename Ptr, typename U>
|
||||
struct pointer_has_rebind_other
|
||||
{
|
||||
template <typename V> struct any
|
||||
{ any(const V&) { } };
|
||||
|
||||
template <typename X>
|
||||
static char test(int, typename X::template rebind<U>::other*);
|
||||
|
||||
template <typename X>
|
||||
static int test(any<int>, void*);
|
||||
|
||||
static const bool value = (1 == sizeof(test<Ptr>(0, 0)));
|
||||
};
|
||||
|
||||
template <typename Ptr, typename U>
|
||||
struct pointer_rebind_mode
|
||||
{
|
||||
static const unsigned int rebind = (unsigned int)pointer_has_rebind<Ptr, U>::value;
|
||||
static const unsigned int rebind_other = (unsigned int)pointer_has_rebind_other<Ptr, U>::value;
|
||||
static const unsigned int mode = rebind + rebind*rebind_other;
|
||||
};
|
||||
|
||||
////////////////////////
|
||||
//struct pointer_rebinder
|
||||
////////////////////////
|
||||
template <typename Ptr, typename U, unsigned int RebindMode>
|
||||
struct pointer_rebinder;
|
||||
|
||||
// Implementation of pointer_rebinder<U>::type if Ptr has
|
||||
// its own rebind<U>::other type (C++03)
|
||||
template <typename Ptr, typename U>
|
||||
struct pointer_rebinder< Ptr, U, 2u >
|
||||
{
|
||||
typedef typename Ptr::template rebind<U>::other type;
|
||||
};
|
||||
|
||||
// Implementation of pointer_rebinder<U>::type if Ptr has
|
||||
// its own rebind template.
|
||||
template <typename Ptr, typename U>
|
||||
struct pointer_rebinder< Ptr, U, 1u >
|
||||
{
|
||||
typedef typename Ptr::template rebind<U> type;
|
||||
};
|
||||
|
||||
// Specialization of pointer_rebinder if Ptr does not
|
||||
// have its own rebind template but has a the form Ptr<A, An...>,
|
||||
// where An... comprises zero or more type parameters.
|
||||
// Many types fit this form, hence many pointers will get a
|
||||
// reasonable default for rebind.
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
template <template <class, class...> class Ptr, typename A, class... An, class U>
|
||||
struct pointer_rebinder<Ptr<A, An...>, U, 0u >
|
||||
{
|
||||
typedef Ptr<U, An...> type;
|
||||
};
|
||||
|
||||
//Needed for non-conforming compilers like GCC 4.3
|
||||
template <template <class> class Ptr, typename A, class U>
|
||||
struct pointer_rebinder<Ptr<A>, U, 0u >
|
||||
{
|
||||
typedef Ptr<U> type;
|
||||
};
|
||||
|
||||
#else //C++03 compilers
|
||||
|
||||
template <template <class> class Ptr //0arg
|
||||
, typename A
|
||||
, class U>
|
||||
struct pointer_rebinder<Ptr<A>, U, 0u>
|
||||
{ typedef Ptr<U> type; };
|
||||
|
||||
template <template <class, class> class Ptr //1arg
|
||||
, typename A, class P0
|
||||
, class U>
|
||||
struct pointer_rebinder<Ptr<A, P0>, U, 0u>
|
||||
{ typedef Ptr<U, P0> type; };
|
||||
|
||||
template <template <class, class, class> class Ptr //2arg
|
||||
, typename A, class P0, class P1
|
||||
, class U>
|
||||
struct pointer_rebinder<Ptr<A, P0, P1>, U, 0u>
|
||||
{ typedef Ptr<U, P0, P1> type; };
|
||||
|
||||
template <template <class, class, class, class> class Ptr //3arg
|
||||
, typename A, class P0, class P1, class P2
|
||||
, class U>
|
||||
struct pointer_rebinder<Ptr<A, P0, P1, P2>, U, 0u>
|
||||
{ typedef Ptr<U, P0, P1, P2> type; };
|
||||
|
||||
template <template <class, class, class, class, class> class Ptr //4arg
|
||||
, typename A, class P0, class P1, class P2, class P3
|
||||
, class U>
|
||||
struct pointer_rebinder<Ptr<A, P0, P1, P2, P3>, U, 0u>
|
||||
{ typedef Ptr<U, P0, P1, P2, P3> type; };
|
||||
|
||||
template <template <class, class, class, class, class, class> class Ptr //5arg
|
||||
, typename A, class P0, class P1, class P2, class P3, class P4
|
||||
, class U>
|
||||
struct pointer_rebinder<Ptr<A, P0, P1, P2, P3, P4>, U, 0u>
|
||||
{ typedef Ptr<U, P0, P1, P2, P3, P4> type; };
|
||||
|
||||
template <template <class, class, class, class, class, class, class> class Ptr //6arg
|
||||
, typename A, class P0, class P1, class P2, class P3, class P4, class P5
|
||||
, class U>
|
||||
struct pointer_rebinder<Ptr<A, P0, P1, P2, P3, P4, P5>, U, 0u>
|
||||
{ typedef Ptr<U, P0, P1, P2, P3, P4, P5> type; };
|
||||
|
||||
template <template <class, class, class, class, class, class, class, class> class Ptr //7arg
|
||||
, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6
|
||||
, class U>
|
||||
struct pointer_rebinder<Ptr<A, P0, P1, P2, P3, P4, P5, P6>, U, 0u>
|
||||
{ typedef Ptr<U, P0, P1, P2, P3, P4, P5, P6> type; };
|
||||
|
||||
template <template <class, class, class, class, class, class, class, class, class> class Ptr //8arg
|
||||
, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7
|
||||
, class U>
|
||||
struct pointer_rebinder<Ptr<A, P0, P1, P2, P3, P4, P5, P6, P7>, U, 0u>
|
||||
{ typedef Ptr<U, P0, P1, P2, P3, P4, P5, P6, P7> type; };
|
||||
|
||||
template <template <class, class, class, class, class, class, class, class, class, class> class Ptr //9arg
|
||||
, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8
|
||||
, class U>
|
||||
struct pointer_rebinder<Ptr<A, P0, P1, P2, P3, P4, P5, P6, P7, P8>, U, 0u>
|
||||
{ typedef Ptr<U, P0, P1, P2, P3, P4, P5, P6, P7, P8> type; };
|
||||
|
||||
template <template <class, class, class, class, class, class, class, class, class, class, class> class Ptr //10arg
|
||||
, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9
|
||||
, class U>
|
||||
struct pointer_rebinder<Ptr<A, P0, P1, P2, P3, P4, P5, P6, P7, P8, P9>, U, 0u>
|
||||
{ typedef Ptr<U, P0, P1, P2, P3, P4, P5, P6, P7, P8, P9> type; };
|
||||
|
||||
#endif //!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
template <typename Ptr, typename U>
|
||||
struct pointer_rebind
|
||||
: public pointer_rebinder<Ptr, U, pointer_rebind_mode<Ptr, U>::mode>
|
||||
{};
|
||||
|
||||
template <typename T, typename U>
|
||||
struct pointer_rebind<T*, U>
|
||||
{ typedef U* type; };
|
||||
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
#endif // defined(BOOST_INTRUSIVE_POINTER_REBIND_HPP)
|
@@ -25,6 +25,8 @@
|
||||
#include <boost/intrusive/intrusive_fwd.hpp>
|
||||
#include <boost/intrusive/detail/workaround.hpp>
|
||||
#include <boost/intrusive/detail/memory_util.hpp>
|
||||
#include <boost/intrusive/pointer_rebind.hpp>
|
||||
#include <boost/intrusive/detail/pointer_element.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
@@ -78,11 +80,11 @@ struct pointer_traits
|
||||
//
|
||||
template <class U> struct rebind_pointer
|
||||
{
|
||||
typedef typename boost::intrusive::detail::type_rebinder<Ptr, U>::type type;
|
||||
typedef typename boost::intrusive::pointer_rebind<Ptr, U>::type type;
|
||||
};
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
template <class U> using rebind = typename boost::intrusive::detail::type_rebinder<Ptr, U>::type;
|
||||
template <class U> using rebind = typename boost::intrusive::pointer_rebind<Ptr, U>::type;
|
||||
#endif
|
||||
#endif //#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
|
||||
|
@@ -26,7 +26,6 @@
|
||||
#include <boost/intrusive/detail/tree_node.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/intrusive/detail/function_detector.hpp>
|
||||
#include <boost/intrusive/detail/utilities.hpp>
|
||||
#include <boost/intrusive/options.hpp>
|
||||
#include <boost/intrusive/rbtree_algorithms.hpp>
|
||||
|
@@ -21,8 +21,6 @@
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
#include <iterator>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
||||
|
@@ -19,9 +19,6 @@
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
|
||||
#include <iterator>
|
||||
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
||||
|
@@ -23,7 +23,6 @@
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <utility>
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
|
@@ -24,10 +24,12 @@
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/intrusive/link_mode.hpp>
|
||||
#include <boost/intrusive/options.hpp>
|
||||
#include <boost/intrusive/detail/is_stateful_value_traits.hpp>
|
||||
#include <boost/intrusive/detail/utilities.hpp>
|
||||
#include <boost/intrusive/detail/default_header_holder.hpp>
|
||||
#include <boost/intrusive/detail/uncast.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/intrusive/detail/slist_iterator.hpp>
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
#include <cstddef> //std::size_t
|
||||
|
@@ -19,8 +19,6 @@
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
#include <iterator>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
||||
|
@@ -16,7 +16,6 @@
|
||||
#include <boost/intrusive/intrusive_fwd.hpp>
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <utility>
|
||||
|
||||
#include <boost/intrusive/detail/assert.hpp>
|
||||
|
@@ -17,7 +17,6 @@
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <utility>
|
||||
|
||||
#include <boost/intrusive/detail/assert.hpp>
|
||||
|
@@ -19,8 +19,6 @@
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
#include <iterator>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
||||
|
@@ -19,9 +19,6 @@
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
#include <iterator>
|
||||
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
||||
|
@@ -166,6 +166,9 @@
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\pointer_plus_bits.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\pointer_rebind.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\pointer_traits.hpp">
|
||||
</File>
|
||||
@@ -262,11 +265,14 @@
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\hashtable_node.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\iiterator.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\is_stateful_value_traits.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\iterator.hpp">
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\list_iterator.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\list_node.hpp">
|
||||
@@ -283,21 +289,33 @@
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\parent_from_member.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\pointer_element.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\preprocessor.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\rbtree_node.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\slist_iterator.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\slist_node.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\std_fwd.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\to_raw_pointer.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\transform_iterator.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\tree_iterator.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\tree_node.hpp">
|
||||
</File>
|
||||
|
@@ -28,7 +28,7 @@ class delete_disposer
|
||||
template <class Pointer>
|
||||
void operator()(Pointer p)
|
||||
{
|
||||
typedef typename std::iterator_traits<Pointer>::value_type value_type;
|
||||
typedef typename boost::intrusive::iterator_traits<Pointer>::value_type value_type;
|
||||
BOOST_STATIC_ASSERT(( detail::is_same<T, value_type>::value ));
|
||||
delete boost::intrusive::detail::to_raw_pointer(p);
|
||||
}
|
||||
|
@@ -8,8 +8,6 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <boost/intrusive/detail/workaround.hpp>
|
||||
//Just for BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED
|
||||
#include <boost/intrusive/detail/has_member_function_callable_with.hpp>
|
||||
#include <cstddef>
|
||||
@@ -25,6 +23,12 @@ struct dont_care
|
||||
dont_care(...);
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct make_dontcare
|
||||
{
|
||||
typedef has_member_function_callable_with::dont_care type;
|
||||
};
|
||||
|
||||
struct private_type
|
||||
{
|
||||
static private_type p;
|
||||
@@ -163,21 +167,17 @@ class has_member_function_named_func
|
||||
namespace intrusive{
|
||||
namespace intrusive_detail{
|
||||
|
||||
|
||||
template<typename Fun>
|
||||
struct funwrap1_func : Fun
|
||||
{
|
||||
using Fun::func;
|
||||
has_member_function_callable_with::private_type
|
||||
func( has_member_function_callable_with::dont_care) const;
|
||||
};
|
||||
|
||||
template<typename Fun , class P0>
|
||||
struct has_member_function_callable_with_func_impl
|
||||
<Fun, true , P0 , void , void>
|
||||
{
|
||||
|
||||
typedef funwrap1_func<Fun> FunWrap;
|
||||
struct FunWrap : Fun
|
||||
{
|
||||
using Fun::func;
|
||||
has_member_function_callable_with::private_type
|
||||
func( has_member_function_callable_with::dont_care) const;
|
||||
};
|
||||
|
||||
static bool const value = (sizeof(has_member_function_callable_with::no_type) ==
|
||||
sizeof(has_member_function_callable_with::is_private_type
|
||||
@@ -192,20 +192,16 @@ class has_member_function_named_func
|
||||
namespace intrusive{
|
||||
namespace intrusive_detail{
|
||||
|
||||
|
||||
template<typename Fun>
|
||||
struct funwrap2_func: Fun
|
||||
{
|
||||
using Fun::func;
|
||||
has_member_function_callable_with::private_type
|
||||
func( has_member_function_callable_with::dont_care , has_member_function_callable_with::dont_care) const;
|
||||
};
|
||||
|
||||
template<typename Fun , class P0 , class P1>
|
||||
struct has_member_function_callable_with_func_impl
|
||||
<Fun, true , P0 , P1 , void>
|
||||
{
|
||||
typedef funwrap2_func<Fun> FunWrap;
|
||||
struct FunWrap: Fun
|
||||
{
|
||||
using Fun::func;
|
||||
has_member_function_callable_with::private_type
|
||||
func( has_member_function_callable_with::dont_care , has_member_function_callable_with::dont_care) const;
|
||||
};
|
||||
|
||||
static bool const value = (sizeof(has_member_function_callable_with::no_type) ==
|
||||
sizeof(has_member_function_callable_with::is_private_type
|
||||
@@ -222,22 +218,18 @@ class has_member_function_named_func
|
||||
namespace intrusive{
|
||||
namespace intrusive_detail{
|
||||
|
||||
|
||||
template<typename Fun>
|
||||
struct funwrap3_func: Fun
|
||||
{
|
||||
using Fun::func;
|
||||
has_member_function_callable_with::private_type
|
||||
func( has_member_function_callable_with::dont_care
|
||||
, has_member_function_callable_with::dont_care
|
||||
, has_member_function_callable_with::dont_care) const;
|
||||
};
|
||||
|
||||
template<typename Fun , class P0 , class P1 , class P2>
|
||||
struct has_member_function_callable_with_func_impl
|
||||
<Fun, true , P0 , P1 , P2 >
|
||||
{
|
||||
typedef funwrap3_func<Fun> FunWrap;
|
||||
struct FunWrap: Fun
|
||||
{
|
||||
using Fun::func;
|
||||
has_member_function_callable_with::private_type
|
||||
func( has_member_function_callable_with::dont_care
|
||||
, has_member_function_callable_with::dont_care
|
||||
, has_member_function_callable_with::dont_care) const;
|
||||
};
|
||||
|
||||
static bool const value = (sizeof(has_member_function_callable_with::no_type) ==
|
||||
sizeof(has_member_function_callable_with::is_private_type
|
||||
@@ -328,26 +320,19 @@ class has_member_function_named_func
|
||||
namespace intrusive{
|
||||
namespace intrusive_detail{
|
||||
|
||||
|
||||
template<typename Fun, class ...DontCares>
|
||||
struct funwrap_func : Fun
|
||||
{
|
||||
using Fun::func;
|
||||
has_member_function_callable_with::private_type
|
||||
func(DontCares...) const;
|
||||
};
|
||||
|
||||
template<typename Fun, class ...Args>
|
||||
struct has_member_function_callable_with_func_impl
|
||||
<Fun, true , Args...>
|
||||
{
|
||||
template<class T>
|
||||
struct make_dontcare
|
||||
template<class ...DontCares>
|
||||
struct FunWrapTmpl : Fun
|
||||
{
|
||||
typedef has_member_function_callable_with::dont_care type;
|
||||
using Fun::func;
|
||||
has_member_function_callable_with::private_type
|
||||
func(DontCares...) const;
|
||||
};
|
||||
|
||||
typedef funwrap_func<Fun, typename make_dontcare<Args>::type...> FunWrap;
|
||||
typedef FunWrapTmpl<typename has_member_function_callable_with::make_dontcare<Args>::type...> FunWrap;
|
||||
|
||||
static bool const value = (sizeof(has_member_function_callable_with::no_type) ==
|
||||
sizeof(has_member_function_callable_with::is_private_type
|
||||
@@ -473,4 +458,3 @@ int main()
|
||||
return 0;
|
||||
|
||||
}
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
@@ -8,11 +8,9 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/remove_pointer.hpp>
|
||||
#include <boost/type_traits/add_pointer.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/intrusive/pack_options.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
struct empty_default{};
|
||||
|
||||
@@ -24,9 +22,9 @@ const bool is_incremental_value = pack_options< empty_default, incremental<true>
|
||||
BOOST_STATIC_ASSERT(( is_incremental_value == true ));
|
||||
|
||||
//Test BOOST_INTRUSIVE_OPTION_TYPE
|
||||
BOOST_INTRUSIVE_OPTION_TYPE(my_pointer, VoidPointer, typename boost::remove_pointer<VoidPointer>::type, my_pointer_type)
|
||||
BOOST_INTRUSIVE_OPTION_TYPE(my_pointer, VoidPointer, typename boost::intrusive::detail::remove_pointer<VoidPointer>::type, my_pointer_type)
|
||||
typedef pack_options< empty_default, my_pointer<void*> >::type::my_pointer_type my_pointer_type;
|
||||
BOOST_STATIC_ASSERT(( boost::is_same<my_pointer_type, void>::value ));
|
||||
BOOST_STATIC_ASSERT(( boost::intrusive::detail::is_same<my_pointer_type, void>::value ));
|
||||
|
||||
//test combination of BOOST_INTRUSIVE_OPTION_CONSTANT and BOOST_INTRUSIVE_OPTION_TYPE
|
||||
// First add new options
|
||||
@@ -37,7 +35,7 @@ struct default_options
|
||||
};
|
||||
|
||||
BOOST_INTRUSIVE_OPTION_CONSTANT(incremental2, bool, Enabled, is_incremental2)
|
||||
BOOST_INTRUSIVE_OPTION_TYPE(my_pointer2, VoidPointer, typename boost::add_pointer<VoidPointer>::type, my_pointer_type2)
|
||||
BOOST_INTRUSIVE_OPTION_TYPE(my_pointer2, VoidPointer, typename boost::intrusive::detail::add_pointer<VoidPointer>::type, my_pointer_type2)
|
||||
typedef pack_options < default_options
|
||||
, incremental<false>
|
||||
, my_pointer<float*>
|
||||
@@ -46,11 +44,11 @@ typedef pack_options < default_options
|
||||
>::type combined_type;
|
||||
BOOST_STATIC_ASSERT(( combined_type::is_incremental == false ));
|
||||
BOOST_STATIC_ASSERT(( combined_type::is_incremental2 == true ));
|
||||
BOOST_STATIC_ASSERT(( boost::is_same<combined_type::my_pointer_type, float >::value ));
|
||||
BOOST_STATIC_ASSERT(( boost::is_same<combined_type::my_pointer_type2, const char**>::value ));
|
||||
BOOST_STATIC_ASSERT(( boost::intrusive::detail::is_same<combined_type::my_pointer_type, float >::value ));
|
||||
BOOST_STATIC_ASSERT(( boost::intrusive::detail::is_same<combined_type::my_pointer_type2, const char**>::value ));
|
||||
|
||||
//test packing the default options leads to a default options type
|
||||
BOOST_STATIC_ASSERT(( boost::is_same<pack_options<default_options>::type, default_options>::value ));
|
||||
BOOST_STATIC_ASSERT(( boost::intrusive::detail::is_same<pack_options<default_options>::type, default_options>::value ));
|
||||
|
||||
int main()
|
||||
{
|
||||
|
@@ -31,12 +31,12 @@ struct my_tag;
|
||||
template<class VoidPointer>
|
||||
struct hooks
|
||||
{
|
||||
typedef slist_base_hook<void_pointer<VoidPointer> > base_hook_type;
|
||||
typedef slist_base_hook<void_pointer<VoidPointer> > base_hook_type;
|
||||
typedef slist_base_hook< link_mode<auto_unlink>
|
||||
, void_pointer<VoidPointer>, tag<my_tag> > auto_base_hook_type;
|
||||
typedef slist_member_hook<void_pointer<VoidPointer>, tag<my_tag> > member_hook_type;
|
||||
, void_pointer<VoidPointer>, tag<my_tag> > auto_base_hook_type;
|
||||
typedef slist_member_hook<void_pointer<VoidPointer>, tag<my_tag> > member_hook_type;
|
||||
typedef slist_member_hook< link_mode<auto_unlink>
|
||||
, void_pointer<VoidPointer> > auto_member_hook_type;
|
||||
, void_pointer<VoidPointer> > auto_member_hook_type;
|
||||
typedef nonhook_node_member< slist_node_traits< VoidPointer >,
|
||||
circular_slist_algorithms
|
||||
> nonhook_node_member_type;
|
||||
@@ -783,9 +783,6 @@ int main(int, char* [])
|
||||
test_main_template<boost::intrusive::smart_ptr<void>, false, true>()();
|
||||
test_main_template<void*, true, true>()();
|
||||
test_main_template<boost::intrusive::smart_ptr<void>, true, true>()();
|
||||
// test (plain pointers) x (nonconst/const size) x (standard node allocator)
|
||||
test_main_template<void*, false, false>()();
|
||||
test_main_template<void*, true, false>()();
|
||||
// test (bounded pointers) x ((nonconst/const size) x (special node allocator)
|
||||
test_main_template_bptr< true >()();
|
||||
test_main_template_bptr< false >()();
|
||||
|
Reference in New Issue
Block a user