Split detail/utilities.hpp into 11 headers to minimize physical coupling and header dependencies

This commit is contained in:
Ion Gaztañaga
2014-10-13 21:46:47 +02:00
parent 7e4b7286ca
commit a2f5d31ad3
56 changed files with 1298 additions and 1091 deletions

View File

@@ -15,7 +15,6 @@
#include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/intrusive_fwd.hpp>
#include <boost/intrusive/detail/utilities.hpp>
#include <boost/intrusive/detail/any_node_and_algorithms.hpp>
#include <boost/intrusive/options.hpp>
#include <boost/intrusive/detail/generic_hook.hpp>
@@ -24,13 +23,7 @@
namespace boost {
namespace intrusive {
/// @cond
template<class VoidPointer>
struct get_any_node_algo
{
typedef any_algorithms<VoidPointer> type;
};
/// @endcond
struct any_empty{};
//! Helper metafunction to define a \c \c any_base_hook that yields to the same
//! type when the same options (either explicitly or implicitly) are used.
@@ -52,7 +45,7 @@ struct make_any_base_hook
>::type packed_options;
typedef generic_hook
< get_any_node_algo<typename packed_options::void_pointer>
< any_algorithms<typename packed_options::void_pointer>
, typename packed_options::tag
, packed_options::link_mode
, AnyBaseHookId
@@ -157,7 +150,7 @@ struct make_any_member_hook
>::type packed_options;
typedef generic_hook
< get_any_node_algo<typename packed_options::void_pointer>
< any_algorithms<typename packed_options::void_pointer>
, member_tag
, packed_options::link_mode
, NoBaseHookId
@@ -260,7 +253,7 @@ struct any_to_get_member_pointer_type
template<class BaseHook, template <class> class NodeTraits>
struct any_to_some_hook
{
typedef typename BaseHook::template pack<empty>::proto_value_traits old_proto_value_traits;
typedef typename BaseHook::template pack<any_empty>::proto_value_traits old_proto_value_traits;
template<class Base>
struct pack : public Base

View File

@@ -15,7 +15,7 @@
#include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/intrusive_fwd.hpp>
#include <boost/intrusive/detail/utilities.hpp>
#include <boost/intrusive/detail/avltree_node.hpp>
#include <boost/intrusive/avltree_algorithms.hpp>
#include <boost/intrusive/options.hpp>
@@ -24,14 +24,6 @@
namespace boost {
namespace intrusive {
/// @cond
template<class VoidPointer, bool OptimizeSize = false>
struct get_avl_set_node_algo
{
typedef avltree_algorithms<avltree_node_traits<VoidPointer, OptimizeSize> > type;
};
/// @endcond
//! Helper metafunction to define a \c avl_set_base_hook that yields to the same
//! type when the same options (either explicitly or implicitly) are used.
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
@@ -51,8 +43,7 @@ struct make_avl_set_base_hook
::type packed_options;
typedef generic_hook
< get_avl_set_node_algo<typename packed_options::void_pointer
,packed_options::optimize_size>
< avltree_algorithms<avltree_node_traits<typename packed_options::void_pointer, packed_options::optimize_size> >
, typename packed_options::tag
, packed_options::link_mode
, AvlTreeBaseHookId
@@ -182,8 +173,7 @@ struct make_avl_set_member_hook
::type packed_options;
typedef generic_hook
< get_avl_set_node_algo<typename packed_options::void_pointer
,packed_options::optimize_size>
< avltree_algorithms<avltree_node_traits<typename packed_options::void_pointer, packed_options::optimize_size> >
, member_tag
, packed_options::link_mode
, NoBaseHookId

View File

@@ -18,7 +18,6 @@
#include <functional>
#include <utility>
#include <boost/intrusive/detail/assert.hpp>
#include <boost/static_assert.hpp>
#include <boost/intrusive/avl_set_hook.hpp>
#include <boost/intrusive/detail/avltree_node.hpp>
@@ -28,7 +27,6 @@
#include <boost/intrusive/detail/mpl.hpp>
#include <boost/intrusive/pointer_traits.hpp>
#include <boost/intrusive/options.hpp>
#include <boost/intrusive/detail/utilities.hpp>
#include <boost/intrusive/avltree_algorithms.hpp>
#include <boost/intrusive/link_mode.hpp>
#include <boost/move/utility_core.hpp>

View File

@@ -15,7 +15,7 @@
#include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/intrusive_fwd.hpp>
#include <boost/intrusive/detail/utilities.hpp>
#include <boost/intrusive/detail/tree_node.hpp>
#include <boost/intrusive/bstree_algorithms.hpp>
#include <boost/intrusive/options.hpp>
@@ -24,14 +24,6 @@
namespace boost {
namespace intrusive {
/// @cond
template<class VoidPointer>
struct get_bs_set_node_algo
{
typedef bstree_algorithms<tree_node_traits<VoidPointer> > type;
};
/// @endcond
//! Helper metafunction to define a \c bs_set_base_hook that yields to the same
//! type when the same options (either explicitly or implicitly) are used.
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
@@ -51,7 +43,7 @@ struct make_bs_set_base_hook
::type packed_options;
typedef generic_hook
< get_bs_set_node_algo<typename packed_options::void_pointer>
< bstree_algorithms<tree_node_traits<typename packed_options::void_pointer> >
, typename packed_options::tag
, packed_options::link_mode
, BsTreeBaseHookId
@@ -180,7 +172,7 @@ struct make_bs_set_member_hook
::type packed_options;
typedef generic_hook
< get_bs_set_node_algo<typename packed_options::void_pointer>
< bstree_algorithms<tree_node_traits<typename packed_options::void_pointer> >
, member_tag
, packed_options::link_mode
, NoBaseHookId

View File

@@ -25,9 +25,16 @@
#include <boost/intrusive/detail/mpl.hpp>
#include <boost/intrusive/pointer_traits.hpp>
#include <boost/intrusive/detail/is_stateful_value_traits.hpp>
#include <boost/intrusive/detail/utilities.hpp>
#include <boost/intrusive/detail/empty_node_checker.hpp>
#include <boost/intrusive/detail/default_header_holder.hpp>
#include <boost/intrusive/detail/reverse_iterator.hpp>
#include <boost/intrusive/detail/exception_disposer.hpp>
#include <boost/intrusive/detail/node_cloner_disposer.hpp>
#include <boost/intrusive/detail/key_nodeptr_comp.hpp>
#include <boost/intrusive/detail/simple_disposers.hpp>
#include <boost/intrusive/detail/size_holder.hpp>
#include <boost/intrusive/detail/algo_type.hpp>
#include <boost/intrusive/options.hpp>
#include <boost/intrusive/bstree_algorithms.hpp>
#include <boost/intrusive/link_mode.hpp>
@@ -208,6 +215,18 @@ struct bstbase3
};
template<class Less, class T>
struct get_less
{
typedef Less type;
};
template<class T>
struct get_less<void, T>
{
typedef ::std::less<T> type;
};
template<class ValueTraits, class VoidOrKeyComp, algo_types AlgoType, typename HeaderHolder>
struct bstbase2
//Put the (possibly empty) functor in the first position to get EBO in MSVC

View File

@@ -18,7 +18,6 @@
#include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/intrusive_fwd.hpp>
#include <boost/intrusive/detail/common_slist_algorithms.hpp>
#include <boost/intrusive/detail/assert.hpp>
#include <boost/intrusive/detail/algo_type.hpp>

View File

@@ -13,8 +13,6 @@
#ifndef BOOST_INTRUSIVE_DETAIL_ALGO_TYPE_HPP
#define BOOST_INTRUSIVE_DETAIL_ALGO_TYPE_HPP
#include <boost/intrusive/detail/config_begin.hpp>
namespace boost {
namespace intrusive {
@@ -41,6 +39,4 @@ struct get_node_checker;
} //namespace intrusive
} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
#endif //BOOST_INTRUSIVE_DETAIL_ALGO_TYPE_HPP

View File

@@ -13,8 +13,6 @@
#ifndef BOOST_INTRUSIVE_ANY_NODE_HPP
#define BOOST_INTRUSIVE_ANY_NODE_HPP
#include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/detail/assert.hpp>
#include <boost/intrusive/pointer_rebind.hpp>
#include <cstddef>
#include <boost/intrusive/detail/mpl.hpp>
@@ -275,6 +273,4 @@ class any_algorithms
} //namespace intrusive
} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
#endif //BOOST_INTRUSIVE_ANY_NODE_HPP

View File

@@ -0,0 +1,86 @@
/////////////////////////////////////////////////////////////////////////////
//
// (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_ARRAY_INITIALIZER_HPP
#define BOOST_INTRUSIVE_DETAIL_ARRAY_INITIALIZER_HPP
#include <boost/core/no_exceptions_support.hpp>
namespace boost {
namespace intrusive {
namespace detail {
//This is not standard, but should work with all compilers
union max_align
{
char char_;
short short_;
int int_;
long long_;
#ifdef BOOST_HAS_LONG_LONG
long long long_long_;
#endif
float float_;
double double_;
long double long_double_;
void * void_ptr_;
};
template<class T, std::size_t N>
class array_initializer
{
public:
template<class CommonInitializer>
array_initializer(const CommonInitializer &init)
{
char *init_buf = (char*)rawbuf;
std::size_t i = 0;
BOOST_TRY{
for(; i != N; ++i){
new(init_buf)T(init);
init_buf += sizeof(T);
}
}
BOOST_CATCH(...){
while(i--){
init_buf -= sizeof(T);
((T*)init_buf)->~T();
}
BOOST_RETHROW;
}
BOOST_CATCH_END
}
operator T* ()
{ return (T*)(rawbuf); }
operator const T*() const
{ return (const T*)(rawbuf); }
~array_initializer()
{
char *init_buf = (char*)rawbuf + N*sizeof(T);
for(std::size_t i = 0; i != N; ++i){
init_buf -= sizeof(T);
((T*)init_buf)->~T();
}
}
private:
detail::max_align rawbuf[(N*sizeof(T)-1)/sizeof(detail::max_align)+1];
};
} //namespace detail{
} //namespace intrusive{
} //namespace boost{
#endif //BOOST_INTRUSIVE_DETAIL_ARRAY_INITIALIZER_HPP

View File

@@ -163,7 +163,7 @@ struct avltree_node_traits_dispatch<VoidPointer, true>
: public compact_avltree_node_traits_impl<VoidPointer>
{};
//Inherit from the detail::link_dispatch depending on the embedding capabilities
//Inherit from rbtree_node_traits_dispatch depending on the embedding capabilities
template<class VoidPointer, bool OptimizeSize = false>
struct avltree_node_traits
: public avltree_node_traits_dispatch

View File

@@ -13,7 +13,6 @@
#ifndef BOOST_INTRUSIVE_COMMON_SLIST_ALGORITHMS_HPP
#define BOOST_INTRUSIVE_COMMON_SLIST_ALGORITHMS_HPP
#include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/intrusive_fwd.hpp>
#include <boost/intrusive/detail/assert.hpp>
#include <boost/intrusive/detail/algo_type.hpp>
@@ -188,6 +187,4 @@ struct get_algo<CommonSListAlgorithms, NodeTraits>
} //namespace intrusive
} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
#endif //BOOST_INTRUSIVE_COMMON_SLIST_ALGORITHMS_HPP

View File

@@ -13,7 +13,6 @@
#ifndef BOOST_INTRUSIVE_DETAIL_DEFAULT_HEADER_HOLDER_HPP
#define BOOST_INTRUSIVE_DETAIL_DEFAULT_HEADER_HOLDER_HPP
#include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/pointer_traits.hpp>
#include <boost/intrusive/detail/to_raw_pointer.hpp>
@@ -59,6 +58,4 @@ struct get_header_holder_type< Value_Traits, void >
} //namespace intrusive
} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
#endif //BOOST_INTRUSIVE_DETAIL_DEFAULT_HEADER_HOLDER_HPP

View File

@@ -1,6 +1,7 @@
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Joaquin M Lopez Munoz 2006-2013
// (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
@@ -13,13 +14,141 @@
#ifndef BOOST_INTRUSIVE_DETAIL_EBO_HOLDER_HPP
#define BOOST_INTRUSIVE_DETAIL_EBO_HOLDER_HPP
#include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/detail/mpl.hpp>
#include <boost/config.hpp>
namespace boost {
namespace intrusive {
namespace detail {
#if defined(BOOST_MSVC) || defined(__BORLANDC_)
#define BOOST_INTRUSIVE_TT_DECL __cdecl
#else
#define BOOST_INTRUSIVE_TT_DECL
#endif
#if defined(_MSC_EXTENSIONS) && !defined(__BORLAND__) && !defined(_WIN64) && !defined(_M_ARM) && !defined(UNDER_CE)
#define BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
#endif
template <typename T>
struct is_unary_or_binary_function_impl
{ static const bool value = false; };
// see boost ticket #4094
// avoid duplicate definitions of is_unary_or_binary_function_impl
#ifndef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
template <typename R>
struct is_unary_or_binary_function_impl<R (*)()>
{ static const bool value = true; };
template <typename R>
struct is_unary_or_binary_function_impl<R (*)(...)>
{ static const bool value = true; };
#else // BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
template <typename R>
struct is_unary_or_binary_function_impl<R (__stdcall*)()>
{ static const bool value = true; };
#ifndef _MANAGED
template <typename R>
struct is_unary_or_binary_function_impl<R (__fastcall*)()>
{ static const bool value = true; };
#endif
template <typename R>
struct is_unary_or_binary_function_impl<R (__cdecl*)()>
{ static const bool value = true; };
template <typename R>
struct is_unary_or_binary_function_impl<R (__cdecl*)(...)>
{ static const bool value = true; };
#endif
// see boost ticket #4094
// avoid duplicate definitions of is_unary_or_binary_function_impl
#ifndef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
template <typename R, class T0>
struct is_unary_or_binary_function_impl<R (*)(T0)>
{ static const bool value = true; };
template <typename R, class T0>
struct is_unary_or_binary_function_impl<R (*)(T0...)>
{ static const bool value = true; };
#else // BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
template <typename R, class T0>
struct is_unary_or_binary_function_impl<R (__stdcall*)(T0)>
{ static const bool value = true; };
#ifndef _MANAGED
template <typename R, class T0>
struct is_unary_or_binary_function_impl<R (__fastcall*)(T0)>
{ static const bool value = true; };
#endif
template <typename R, class T0>
struct is_unary_or_binary_function_impl<R (__cdecl*)(T0)>
{ static const bool value = true; };
template <typename R, class T0>
struct is_unary_or_binary_function_impl<R (__cdecl*)(T0...)>
{ static const bool value = true; };
#endif
// see boost ticket #4094
// avoid duplicate definitions of is_unary_or_binary_function_impl
#ifndef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
template <typename R, class T0, class T1>
struct is_unary_or_binary_function_impl<R (*)(T0, T1)>
{ static const bool value = true; };
template <typename R, class T0, class T1>
struct is_unary_or_binary_function_impl<R (*)(T0, T1...)>
{ static const bool value = true; };
#else // BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
template <typename R, class T0, class T1>
struct is_unary_or_binary_function_impl<R (__stdcall*)(T0, T1)>
{ static const bool value = true; };
#ifndef _MANAGED
template <typename R, class T0, class T1>
struct is_unary_or_binary_function_impl<R (__fastcall*)(T0, T1)>
{ static const bool value = true; };
#endif
template <typename R, class T0, class T1>
struct is_unary_or_binary_function_impl<R (__cdecl*)(T0, T1)>
{ static const bool value = true; };
template <typename R, class T0, class T1>
struct is_unary_or_binary_function_impl<R (__cdecl*)(T0, T1...)>
{ static const bool value = true; };
#endif
template <typename T>
struct is_unary_or_binary_function_impl<T&>
{ static const bool value = false; };
template<typename T>
struct is_unary_or_binary_function : is_unary_or_binary_function_impl<T>
{};
template<typename T, bool IsEmpty = true>
class ebo_functor_holder_impl
{
@@ -90,6 +219,4 @@ class ebo_functor_holder
} //namespace intrusive {
} //namespace boost {
#include <boost/intrusive/detail/config_end.hpp>
#endif //#ifndef BOOST_INTRUSIVE_DETAIL_EBO_HOLDER_HPP

View File

@@ -0,0 +1,36 @@
/////////////////////////////////////////////////////////////////////////////
//
// (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_EMPTY_NODE_CHECKER_HPP
#define BOOST_INTRUSIVE_DETAIL_EMPTY_NODE_CHECKER_HPP
namespace boost {
namespace intrusive {
namespace detail {
template<class ValueTraits>
struct empty_node_checker
{
typedef ValueTraits value_traits;
typedef typename value_traits::node_traits node_traits;
typedef typename node_traits::const_node_ptr const_node_ptr;
struct return_type {};
void operator () (const const_node_ptr&, const return_type&, const return_type&, return_type&) {}
};
} //namespace detail{
} //namespace intrusive{
} //namespace boost{
#endif //BOOST_INTRUSIVE_DETAIL_EMPTY_NODE_CHECKER_HPP

View File

@@ -0,0 +1,40 @@
/////////////////////////////////////////////////////////////////////////////
//
// (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_EQUAL_TO_VALUE_HPP
#define BOOST_INTRUSIVE_DETAIL_EQUAL_TO_VALUE_HPP
namespace boost {
namespace intrusive {
namespace detail {
//This functor compares a stored value
//and the one passed as an argument
template<class ConstReference>
class equal_to_value
{
ConstReference t_;
public:
equal_to_value(ConstReference t)
: t_(t)
{}
bool operator()(ConstReference t)const
{ return t_ == t; }
};
} //namespace detail{
} //namespace intrusive{
} //namespace boost{
#endif //BOOST_INTRUSIVE_DETAIL_EQUAL_TO_VALUE_HPP

View File

@@ -0,0 +1,80 @@
/////////////////////////////////////////////////////////////////////////////
//
// (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_EXCEPTION_DISPOSER_HPP
#define BOOST_INTRUSIVE_DETAIL_EXCEPTION_DISPOSER_HPP
namespace boost {
namespace intrusive {
namespace detail {
template<class Container, class Disposer>
class exception_disposer
{
Container *cont_;
Disposer &disp_;
exception_disposer(const exception_disposer&);
exception_disposer &operator=(const exception_disposer&);
public:
exception_disposer(Container &cont, Disposer &disp)
: cont_(&cont), disp_(disp)
{}
void release()
{ cont_ = 0; }
~exception_disposer()
{
if(cont_){
cont_->clear_and_dispose(disp_);
}
}
};
template<class Container, class Disposer, class SizeType>
class exception_array_disposer
{
Container *cont_;
Disposer &disp_;
SizeType &constructed_;
exception_array_disposer(const exception_array_disposer&);
exception_array_disposer &operator=(const exception_array_disposer&);
public:
exception_array_disposer
(Container &cont, Disposer &disp, SizeType &constructed)
: cont_(&cont), disp_(disp), constructed_(constructed)
{}
void release()
{ cont_ = 0; }
~exception_array_disposer()
{
SizeType n = constructed_;
if(cont_){
while(n--){
cont_[n].clear_and_dispose(disp_);
}
}
}
};
} //namespace detail{
} //namespace intrusive{
} //namespace boost{
#endif //BOOST_INTRUSIVE_DETAIL_EXCEPTION_DISPOSER_HPP

View File

@@ -22,8 +22,6 @@
#ifndef BOOST_INTRUSIVE_DETAIL_FUNCTION_DETECTOR_HPP
#define BOOST_INTRUSIVE_DETAIL_FUNCTION_DETECTOR_HPP
#include <boost/intrusive/detail/config_begin.hpp>
namespace boost {
namespace intrusive {
namespace function_detector {
@@ -83,6 +81,4 @@ namespace function_detector {
ReturnType (*)Params \
>::check
#include <boost/intrusive/detail/config_end.hpp>
#endif //@ifndef BOOST_INTRUSIVE_DETAIL_FUNCTION_DETECTOR_HPP

View File

@@ -13,12 +13,10 @@
#ifndef BOOST_INTRUSIVE_GENERIC_HOOK_HPP
#define BOOST_INTRUSIVE_GENERIC_HOOK_HPP
#include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/intrusive_fwd.hpp>
#include <boost/intrusive/pointer_traits.hpp>
#include <boost/intrusive/link_mode.hpp>
#include <boost/intrusive/detail/utilities.hpp>
#include <boost/intrusive/detail/mpl.hpp>
#include <boost/intrusive/detail/assert.hpp>
#include <boost/static_assert.hpp>
namespace boost {
@@ -26,6 +24,30 @@ namespace intrusive {
/// @cond
namespace detail {
template <link_mode_type LinkMode>
struct link_dispatch
{};
template<class Hook>
void destructor_impl(Hook &hook, detail::link_dispatch<safe_link>)
{ //If this assertion raises, you might have destroyed an object
//while it was still inserted in a container that is alive.
//If so, remove the object from the container before destroying it.
(void)hook; BOOST_INTRUSIVE_SAFE_HOOK_DESTRUCTOR_ASSERT(!hook.is_linked());
}
template<class Hook>
void destructor_impl(Hook &hook, detail::link_dispatch<auto_unlink>)
{ hook.unlink(); }
template<class Hook>
void destructor_impl(Hook &, detail::link_dispatch<normal_link>)
{}
} //namespace detail {
enum base_hook_type
{ NoBaseHookId
, ListBaseHookId
@@ -89,7 +111,7 @@ struct hooktags_impl
/// @endcond
template
< class GetNodeAlgorithms
< class NodeAlgorithms
, class Tag
, link_mode_type LinkMode
, base_hook_type BaseHookType
@@ -104,20 +126,20 @@ class generic_hook
//from the hook.
: public detail::if_c
< detail::is_same<Tag, member_tag>::value
, typename GetNodeAlgorithms::type::node
, node_holder<typename GetNodeAlgorithms::type::node, Tag, BaseHookType>
, typename NodeAlgorithms::node
, node_holder<typename NodeAlgorithms::node, Tag, BaseHookType>
>::type
//If this is the a default-tagged base hook derive from a class that
//will define an special internal typedef. Containers will be able to detect this
//special typedef and obtain generic_hook's internal types in order to deduce
//value_traits for this hook.
, public hook_tags_definer
< generic_hook<GetNodeAlgorithms, Tag, LinkMode, BaseHookType>
< generic_hook<NodeAlgorithms, Tag, LinkMode, BaseHookType>
, detail::is_same<Tag, default_tag>::value*BaseHookType>
/// @endcond
{
/// @cond
typedef typename GetNodeAlgorithms::type node_algorithms;
typedef NodeAlgorithms node_algorithms;
typedef typename node_algorithms::node node;
typedef typename node_algorithms::node_ptr node_ptr;
typedef typename node_algorithms::const_node_ptr const_node_ptr;
@@ -125,7 +147,7 @@ class generic_hook
public:
typedef hooktags_impl
< typename GetNodeAlgorithms::type::node_traits
< typename NodeAlgorithms::node_traits
, Tag, LinkMode, BaseHookType> hooktags;
node_ptr this_ptr()
@@ -187,6 +209,4 @@ class generic_hook
} //namespace intrusive
} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
#endif //BOOST_INTRUSIVE_GENERIC_HOOK_HPP

View File

@@ -13,11 +13,9 @@
#ifndef BOOST_INTRUSIVE_HASHTABLE_NODE_HPP
#define BOOST_INTRUSIVE_HASHTABLE_NODE_HPP
#include <boost/intrusive/detail/config_begin.hpp>
#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/trivial_value_traits.hpp>
#include <boost/intrusive/slist.hpp> //make_slist
#include <cstddef>

View File

@@ -0,0 +1,234 @@
/////////////////////////////////////////////////////////////////////////////
//
// (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_HOOK_TRAITS_HPP
#define BOOST_INTRUSIVE_DETAIL_HOOK_TRAITS_HPP
#include <boost/intrusive/pointer_traits.hpp>
#include <boost/intrusive/detail/parent_from_member.hpp>
#include <boost/intrusive/link_mode.hpp>
#include <boost/intrusive/detail/mpl.hpp>
#include <boost/intrusive/detail/to_raw_pointer.hpp>
#include <boost/intrusive/detail/node_holder.hpp>
namespace boost {
namespace intrusive {
template<class T, class NodePtr, class Tag, unsigned int Type>
struct bhtraits_base
{
public:
typedef NodePtr node_ptr;
typedef typename pointer_traits<node_ptr>::element_type node;
typedef node_holder<node, Tag, Type> node_holder_type;
typedef T value_type;
typedef typename pointer_traits<node_ptr>::
template rebind_pointer<const node>::type const_node_ptr;
typedef typename pointer_traits<node_ptr>::
template rebind_pointer<T>::type pointer;
typedef typename pointer_traits<node_ptr>::
template rebind_pointer<const T>::type const_pointer;
//typedef typename pointer_traits<pointer>::reference reference;
//typedef typename pointer_traits<const_pointer>::reference const_reference;
typedef T & reference;
typedef const T & const_reference;
typedef node_holder_type & node_holder_reference;
typedef const node_holder_type & const_node_holder_reference;
typedef node& node_reference;
typedef const node & const_node_reference;
static pointer to_value_ptr(const node_ptr & n)
{
return pointer_traits<pointer>::pointer_to
(static_cast<reference>(static_cast<node_holder_reference>(*n)));
}
static const_pointer to_value_ptr(const const_node_ptr & n)
{
return pointer_traits<const_pointer>::pointer_to
(static_cast<const_reference>(static_cast<const_node_holder_reference>(*n)));
}
static node_ptr to_node_ptr(reference value)
{
return pointer_traits<node_ptr>::pointer_to
(static_cast<node_reference>(static_cast<node_holder_reference>(value)));
}
static const_node_ptr to_node_ptr(const_reference value)
{
return pointer_traits<const_node_ptr>::pointer_to
(static_cast<const_node_reference>(static_cast<const_node_holder_reference>(value)));
}
};
template<class T, class NodeTraits, link_mode_type LinkMode, class Tag, unsigned int Type>
struct bhtraits
: public bhtraits_base<T, typename NodeTraits::node_ptr, Tag, Type>
{
static const link_mode_type link_mode = LinkMode;
typedef NodeTraits node_traits;
};
/*
template<class T, class NodePtr, typename pointer_traits<NodePtr>::element_type T::* P>
struct mhtraits_base
{
public:
typedef typename pointer_traits<NodePtr>::element_type node;
typedef T value_type;
typedef NodePtr node_ptr;
typedef typename pointer_traits<node_ptr>::
template rebind_pointer<const node>::type const_node_ptr;
typedef typename pointer_traits<node_ptr>::
template rebind_pointer<T>::type pointer;
typedef typename pointer_traits<node_ptr>::
template rebind_pointer<const T>::type const_pointer;
typedef T & reference;
typedef const T & const_reference;
typedef node& node_reference;
typedef const node & const_node_reference;
static node_ptr to_node_ptr(reference value)
{
return pointer_traits<node_ptr>::pointer_to
(static_cast<node_reference>(value.*P));
}
static const_node_ptr to_node_ptr(const_reference value)
{
return pointer_traits<const_node_ptr>::pointer_to
(static_cast<const_node_reference>(value.*P));
}
static pointer to_value_ptr(const node_ptr & n)
{
return pointer_traits<pointer>::pointer_to
(*detail::parent_from_member<T, node>
(boost::intrusive::detail::to_raw_pointer(n), P));
}
static const_pointer to_value_ptr(const const_node_ptr & n)
{
return pointer_traits<const_pointer>::pointer_to
(*detail::parent_from_member<T, node>
(boost::intrusive::detail::to_raw_pointer(n), P));
}
};
template<class T, class NodeTraits, typename NodeTraits::node T::* P, link_mode_type LinkMode>
struct mhtraits
: public mhtraits_base<T, typename NodeTraits::node_ptr, P>
{
static const link_mode_type link_mode = LinkMode;
typedef NodeTraits node_traits;
};
*/
template<class T, class Hook, Hook T::* P>
struct mhtraits
{
public:
typedef Hook hook_type;
typedef typename hook_type::hooktags::node_traits node_traits;
typedef typename node_traits::node node;
typedef T value_type;
typedef typename node_traits::node_ptr node_ptr;
typedef typename node_traits::const_node_ptr const_node_ptr;
typedef typename pointer_traits<node_ptr>::
template rebind_pointer<T>::type pointer;
typedef typename pointer_traits<node_ptr>::
template rebind_pointer<const T>::type const_pointer;
typedef T & reference;
typedef const T & const_reference;
typedef node& node_reference;
typedef const node & const_node_reference;
typedef hook_type& hook_reference;
typedef const hook_type & const_hook_reference;
static const link_mode_type link_mode = Hook::hooktags::link_mode;
static node_ptr to_node_ptr(reference value)
{
return pointer_traits<node_ptr>::pointer_to
(static_cast<node_reference>(static_cast<hook_reference>(value.*P)));
}
static const_node_ptr to_node_ptr(const_reference value)
{
return pointer_traits<const_node_ptr>::pointer_to
(static_cast<const_node_reference>(static_cast<const_hook_reference>(value.*P)));
}
static pointer to_value_ptr(const node_ptr & n)
{
return pointer_traits<pointer>::pointer_to
(*detail::parent_from_member<T, Hook>
(static_cast<Hook*>(boost::intrusive::detail::to_raw_pointer(n)), P));
}
static const_pointer to_value_ptr(const const_node_ptr & n)
{
return pointer_traits<const_pointer>::pointer_to
(*detail::parent_from_member<T, Hook>
(static_cast<const Hook*>(boost::intrusive::detail::to_raw_pointer(n)), P));
}
};
template<class Functor>
struct fhtraits
{
public:
typedef typename Functor::hook_type hook_type;
typedef typename Functor::hook_ptr hook_ptr;
typedef typename Functor::const_hook_ptr const_hook_ptr;
typedef typename hook_type::hooktags::node_traits node_traits;
typedef typename node_traits::node node;
typedef typename Functor::value_type value_type;
typedef typename node_traits::node_ptr node_ptr;
typedef typename node_traits::const_node_ptr const_node_ptr;
typedef typename pointer_traits<node_ptr>::
template rebind_pointer<value_type>::type pointer;
typedef typename pointer_traits<node_ptr>::
template rebind_pointer<const value_type>::type const_pointer;
typedef value_type & reference;
typedef const value_type & const_reference;
static const link_mode_type link_mode = hook_type::hooktags::link_mode;
static node_ptr to_node_ptr(reference value)
{ return static_cast<node*>(boost::intrusive::detail::to_raw_pointer(Functor::to_hook_ptr(value))); }
static const_node_ptr to_node_ptr(const_reference value)
{ return static_cast<const node*>(boost::intrusive::detail::to_raw_pointer(Functor::to_hook_ptr(value))); }
static pointer to_value_ptr(const node_ptr & n)
{ return Functor::to_value_ptr(to_hook_ptr(n)); }
static const_pointer to_value_ptr(const const_node_ptr & n)
{ return Functor::to_value_ptr(to_hook_ptr(n)); }
private:
static hook_ptr to_hook_ptr(const node_ptr & n)
{ return hook_ptr(&*static_cast<hook_type*>(&*n)); }
static const_hook_ptr to_hook_ptr(const const_node_ptr & n)
{ return const_hook_ptr(&*static_cast<const hook_type*>(&*n)); }
};
} //namespace intrusive
} //namespace boost
#endif //BOOST_INTRUSIVE_DETAIL_HOOK_TRAITS_HPP

View File

@@ -13,7 +13,6 @@
#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>
@@ -221,6 +220,4 @@ typename iterator_traits<InputIt>::difference_type iterator_distance(InputIt fir
} //namespace intrusive
} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
#endif //BOOST_INTRUSIVE_DETAIL_IITERATOR_HPP

View File

@@ -13,8 +13,6 @@
#ifndef BOOST_INTRUSIVE_DETAIL_IS_STATEFUL_VALUE_TRAITS_HPP
#define BOOST_INTRUSIVE_DETAIL_IS_STATEFUL_VALUE_TRAITS_HPP
#include <boost/intrusive/detail/config_begin.hpp>
#if defined(_MSC_VER) && (_MSC_VER <= 1310)
#include <boost/intrusive/detail/mpl.hpp>
@@ -72,6 +70,4 @@ struct is_stateful_value_traits
#endif
#include <boost/intrusive/detail/config_end.hpp>
#endif //@ifndef BOOST_INTRUSIVE_DETAIL_IS_STATEFUL_VALUE_TRAITS_HPP

View File

@@ -0,0 +1,68 @@
/////////////////////////////////////////////////////////////////////////////
//
// (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_KEY_NODEPTR_COMP_HPP
#define BOOST_INTRUSIVE_DETAIL_KEY_NODEPTR_COMP_HPP
#include <boost/intrusive/detail/mpl.hpp>
#include <boost/intrusive/detail/ebo_functor_holder.hpp>
namespace boost {
namespace intrusive {
namespace detail {
template<class KeyValueCompare, class ValueTraits>
struct key_nodeptr_comp
: private ebo_functor_holder<KeyValueCompare>
{
typedef ValueTraits value_traits;
typedef typename value_traits::value_type value_type;
typedef typename value_traits::node_ptr node_ptr;
typedef typename value_traits::const_node_ptr const_node_ptr;
typedef ebo_functor_holder<KeyValueCompare> base_t;
key_nodeptr_comp(KeyValueCompare kcomp, const ValueTraits *traits)
: base_t(kcomp), traits_(traits)
{}
template<class T>
struct is_node_ptr
{
static const bool value = is_same<T, const_node_ptr>::value || is_same<T, node_ptr>::value;
};
template<class T>
const value_type & key_forward
(const T &node, typename enable_if_c<is_node_ptr<T>::value>::type * = 0) const
{ return *traits_->to_value_ptr(node); }
template<class T>
const T & key_forward(const T &key, typename enable_if_c<!is_node_ptr<T>::value>::type* = 0) const
{ return key; }
template<class KeyType, class KeyType2>
bool operator()(const KeyType &key1, const KeyType2 &key2) const
{ return base_t::get()(this->key_forward(key1), this->key_forward(key2)); }
template<class KeyType>
bool operator()(const KeyType &key1) const
{ return base_t::get()(this->key_forward(key1)); }
const ValueTraits *const traits_;
};
} //namespace detail{
} //namespace intrusive{
} //namespace boost{
#endif //BOOST_INTRUSIVE_DETAIL_KEY_NODEPTR_COMP_HPP

View File

@@ -14,7 +14,6 @@
#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>
@@ -123,6 +122,4 @@ class list_iterator
} //namespace intrusive
} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
#endif //BOOST_INTRUSIVE_LIST_ITERATOR_HPP

View File

@@ -14,7 +14,6 @@
#ifndef BOOST_INTRUSIVE_LIST_NODE_HPP
#define BOOST_INTRUSIVE_LIST_NODE_HPP
#include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/pointer_rebind.hpp>
namespace boost {
@@ -61,6 +60,4 @@ struct list_node_traits
} //namespace intrusive
} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
#endif //BOOST_INTRUSIVE_LIST_NODE_HPP

View File

@@ -13,8 +13,6 @@
#ifndef BOOST_INTRUSIVE_DETAIL_MATH_HPP
#define BOOST_INTRUSIVE_DETAIL_MATH_HPP
#include <boost/intrusive/detail/config_begin.hpp>
#include <cstddef>
#include <climits>
@@ -266,6 +264,4 @@ inline std::size_t sqrt2_pow_2xplus1 (std::size_t x)
} //namespace intrusive
} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
#endif //BOOST_INTRUSIVE_DETAIL_MATH_HPP

View File

@@ -21,7 +21,6 @@
# pragma once
#endif
#include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/detail/workaround.hpp>
#include <boost/intrusive/detail/mpl.hpp>
#include <boost/intrusive/detail/preprocessor.hpp>
@@ -90,6 +89,4 @@ BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(value_traits_ptr)
} //namespace intrusive {
} //namespace boost {
#include <boost/intrusive/detail/config_end.hpp>
#endif // ! defined(BOOST_INTRUSIVE_ALLOCATOR_MEMORY_UTIL_HPP)

View File

@@ -215,134 +215,16 @@ struct identity
typedef T type;
};
#if defined(BOOST_MSVC) || defined(__BORLANDC_)
#define BOOST_INTRUSIVE_TT_DECL __cdecl
#else
#define BOOST_INTRUSIVE_TT_DECL
#endif
template<class T, bool Add>
struct add_const_if_c
{
typedef typename if_c
< Add
, typename add_const<T>::type
, T
>::type type;
};
#if defined(_MSC_EXTENSIONS) && !defined(__BORLAND__) && !defined(_WIN64) && !defined(_M_ARM) && !defined(UNDER_CE)
#define BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
#endif
template <typename T>
struct is_unary_or_binary_function_impl
{ static const bool value = false; };
// see boost ticket #4094
// avoid duplicate definitions of is_unary_or_binary_function_impl
#ifndef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
template <typename R>
struct is_unary_or_binary_function_impl<R (*)()>
{ static const bool value = true; };
template <typename R>
struct is_unary_or_binary_function_impl<R (*)(...)>
{ static const bool value = true; };
#else // BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
template <typename R>
struct is_unary_or_binary_function_impl<R (__stdcall*)()>
{ static const bool value = true; };
#ifndef _MANAGED
template <typename R>
struct is_unary_or_binary_function_impl<R (__fastcall*)()>
{ static const bool value = true; };
#endif
template <typename R>
struct is_unary_or_binary_function_impl<R (__cdecl*)()>
{ static const bool value = true; };
template <typename R>
struct is_unary_or_binary_function_impl<R (__cdecl*)(...)>
{ static const bool value = true; };
#endif
// see boost ticket #4094
// avoid duplicate definitions of is_unary_or_binary_function_impl
#ifndef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
template <typename R, class T0>
struct is_unary_or_binary_function_impl<R (*)(T0)>
{ static const bool value = true; };
template <typename R, class T0>
struct is_unary_or_binary_function_impl<R (*)(T0...)>
{ static const bool value = true; };
#else // BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
template <typename R, class T0>
struct is_unary_or_binary_function_impl<R (__stdcall*)(T0)>
{ static const bool value = true; };
#ifndef _MANAGED
template <typename R, class T0>
struct is_unary_or_binary_function_impl<R (__fastcall*)(T0)>
{ static const bool value = true; };
#endif
template <typename R, class T0>
struct is_unary_or_binary_function_impl<R (__cdecl*)(T0)>
{ static const bool value = true; };
template <typename R, class T0>
struct is_unary_or_binary_function_impl<R (__cdecl*)(T0...)>
{ static const bool value = true; };
#endif
// see boost ticket #4094
// avoid duplicate definitions of is_unary_or_binary_function_impl
#ifndef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
template <typename R, class T0, class T1>
struct is_unary_or_binary_function_impl<R (*)(T0, T1)>
{ static const bool value = true; };
template <typename R, class T0, class T1>
struct is_unary_or_binary_function_impl<R (*)(T0, T1...)>
{ static const bool value = true; };
#else // BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
template <typename R, class T0, class T1>
struct is_unary_or_binary_function_impl<R (__stdcall*)(T0, T1)>
{ static const bool value = true; };
#ifndef _MANAGED
template <typename R, class T0, class T1>
struct is_unary_or_binary_function_impl<R (__fastcall*)(T0, T1)>
{ static const bool value = true; };
#endif
template <typename R, class T0, class T1>
struct is_unary_or_binary_function_impl<R (__cdecl*)(T0, T1)>
{ static const bool value = true; };
template <typename R, class T0, class T1>
struct is_unary_or_binary_function_impl<R (__cdecl*)(T0, T1...)>
{ static const bool value = true; };
#endif
template <typename T>
struct is_unary_or_binary_function_impl<T&>
{ static const bool value = false; };
template<typename T>
struct is_unary_or_binary_function
{ static const bool value = is_unary_or_binary_function_impl<T>::value; };
//boost::alignment_of yields to 10K lines of preprocessed code, so we
//need an alternative
@@ -463,6 +345,24 @@ template <> struct unvoid_ref<const void> { struct type_impl { }; typedef type_i
boost_intrusive_eval_default_type_ ## TNAME< T, TIMPL >::type \
//
#define BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(TRAITS_PREFIX, TYPEDEF_TO_FIND) \
template <class T>\
struct TRAITS_PREFIX##_bool\
{\
template<bool Add>\
struct two_or_three {one _[2 + Add];};\
template <class U> static one test(...);\
template <class U> static two_or_three<U::TYPEDEF_TO_FIND> test (int);\
static const std::size_t value = sizeof(test<T>(0));\
};\
\
template <class T>\
struct TRAITS_PREFIX##_bool_is_true\
{\
static const bool value = TRAITS_PREFIX##_bool<T>::value > sizeof(one)*2;\
};\
//
} //namespace detail
} //namespace intrusive
} //namespace boost

View File

@@ -0,0 +1,105 @@
/////////////////////////////////////////////////////////////////////////////
//
// (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_NODE_CLONER_DISPOSER_HPP
#define BOOST_INTRUSIVE_DETAIL_NODE_CLONER_DISPOSER_HPP
#include <boost/intrusive/link_mode.hpp>
#include <boost/intrusive/detail/ebo_functor_holder.hpp>
#include <boost/intrusive/detail/algo_type.hpp>
#include <boost/intrusive/detail/assert.hpp>
namespace boost {
namespace intrusive {
namespace detail {
template<class F, class ValueTraits, algo_types AlgoType>
struct node_cloner
: private ebo_functor_holder<F>
{
typedef ValueTraits value_traits;
typedef typename value_traits::node_traits node_traits;
typedef typename node_traits::node_ptr node_ptr;
typedef ebo_functor_holder<F> base_t;
typedef typename get_algo< AlgoType
, node_traits>::type node_algorithms;
static const bool safemode_or_autounlink =
is_safe_autounlink<value_traits::link_mode>::value;
typedef typename value_traits::value_type value_type;
typedef typename value_traits::pointer pointer;
typedef typename node_traits::node node;
typedef typename value_traits::const_node_ptr const_node_ptr;
typedef typename value_traits::reference reference;
typedef typename value_traits::const_reference const_reference;
node_cloner(F f, const ValueTraits *traits)
: base_t(f), traits_(traits)
{}
// tree-based containers use this method, which is proxy-reference friendly
node_ptr operator()(const node_ptr & p)
{
const_reference v = *traits_->to_value_ptr(p);
node_ptr n = traits_->to_node_ptr(*base_t::get()(v));
//Cloned node must be in default mode if the linking mode requires it
if(safemode_or_autounlink)
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(n));
return n;
}
// hashtables use this method, which is proxy-reference unfriendly
node_ptr operator()(const node &to_clone)
{
const value_type &v =
*traits_->to_value_ptr
(pointer_traits<const_node_ptr>::pointer_to(to_clone));
node_ptr n = traits_->to_node_ptr(*base_t::get()(v));
//Cloned node must be in default mode if the linking mode requires it
if(safemode_or_autounlink)
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(n));
return n;
}
const ValueTraits * const traits_;
};
template<class F, class ValueTraits, algo_types AlgoType>
struct node_disposer
: private ebo_functor_holder<F>
{
typedef ValueTraits value_traits;
typedef typename value_traits::node_traits node_traits;
typedef typename node_traits::node_ptr node_ptr;
typedef ebo_functor_holder<F> base_t;
typedef typename get_algo< AlgoType
, node_traits>::type node_algorithms;
static const bool safemode_or_autounlink =
is_safe_autounlink<value_traits::link_mode>::value;
node_disposer(F f, const ValueTraits *cont)
: base_t(f), traits_(cont)
{}
void operator()(const node_ptr & p)
{
if(safemode_or_autounlink)
node_algorithms::init(p);
base_t::get()(traits_->to_value_ptr(p));
}
const ValueTraits * const traits_;
};
} //namespace detail{
} //namespace intrusive{
} //namespace boost{
#endif //BOOST_INTRUSIVE_DETAIL_NODE_CLONER_DISPOSER_HPP

View File

@@ -0,0 +1,27 @@
/////////////////////////////////////////////////////////////////////////////
//
// (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_NODE_HOLDER_HPP
#define BOOST_INTRUSIVE_DETAIL_NODE_HOLDER_HPP
namespace boost {
namespace intrusive {
template<class Node, class Tag, unsigned int>
struct node_holder
: public Node
{};
} //namespace intrusive{
} //namespace boost{
#endif //BOOST_INTRUSIVE_DETAIL_NODE_HOLDER_HPP

View File

@@ -0,0 +1,122 @@
/////////////////////////////////////////////////////////////////////////////
//
// (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_NODE_TO_VALUE_HPP
#define BOOST_INTRUSIVE_DETAIL_NODE_TO_VALUE_HPP
#include <boost/intrusive/pointer_traits.hpp>
#include <boost/intrusive/detail/mpl.hpp>
#include <boost/intrusive/detail/is_stateful_value_traits.hpp>
namespace boost {
namespace intrusive {
namespace detail {
template<class VoidPointer>
struct dummy_constptr
{
typedef typename boost::intrusive::pointer_traits<VoidPointer>::
template rebind_pointer<const void>::type ConstVoidPtr;
explicit dummy_constptr(ConstVoidPtr)
{}
dummy_constptr()
{}
ConstVoidPtr get_ptr() const
{ return ConstVoidPtr(); }
};
template<class VoidPointer>
struct constptr
{
typedef typename boost::intrusive::pointer_traits<VoidPointer>::
template rebind_pointer<const void>::type ConstVoidPtr;
constptr()
{}
explicit constptr(const ConstVoidPtr &ptr)
: const_void_ptr_(ptr)
{}
const void *get_ptr() const
{ return boost::intrusive::detail::to_raw_pointer(const_void_ptr_); }
ConstVoidPtr const_void_ptr_;
};
template <class VoidPointer, bool store_ptr>
struct select_constptr
{
typedef typename if_c
< store_ptr
, constptr<VoidPointer>
, dummy_constptr<VoidPointer>
>::type type;
};
template<class ValueTraits, bool IsConst>
struct node_to_value
: public select_constptr
< typename pointer_traits
<typename ValueTraits::pointer>::template rebind_pointer<void>::type
, is_stateful_value_traits<ValueTraits>::value
>::type
{
static const bool stateful_value_traits = is_stateful_value_traits<ValueTraits>::value;
typedef typename select_constptr
< typename pointer_traits
<typename ValueTraits::pointer>::
template rebind_pointer<void>::type
, stateful_value_traits >::type Base;
typedef ValueTraits value_traits;
typedef typename value_traits::value_type value_type;
typedef typename value_traits::node_traits::node node;
typedef typename add_const_if_c
<value_type, IsConst>::type vtype;
typedef typename add_const_if_c
<node, IsConst>::type ntype;
typedef typename pointer_traits
<typename ValueTraits::pointer>::
template rebind_pointer<ntype>::type npointer;
typedef typename pointer_traits<npointer>::
template rebind_pointer<const ValueTraits>::type const_value_traits_ptr;
node_to_value(const const_value_traits_ptr &ptr)
: Base(ptr)
{}
typedef vtype & result_type;
typedef ntype & first_argument_type;
const_value_traits_ptr get_value_traits() const
{ return pointer_traits<const_value_traits_ptr>::static_cast_from(Base::get_ptr()); }
result_type to_value(first_argument_type arg, false_) const
{ return *(value_traits::to_value_ptr(pointer_traits<npointer>::pointer_to(arg))); }
result_type to_value(first_argument_type arg, true_) const
{ return *(this->get_value_traits()->to_value_ptr(pointer_traits<npointer>::pointer_to(arg))); }
result_type operator()(first_argument_type arg) const
{ return this->to_value(arg, bool_<stateful_value_traits>()); }
};
} //namespace detail{
} //namespace intrusive{
} //namespace boost{
#endif //BOOST_INTRUSIVE_DETAIL_NODE_TO_VALUE_HPP

View File

@@ -19,7 +19,6 @@
#include <boost/intrusive/rbtree_algorithms.hpp>
#include <boost/intrusive/pointer_plus_bits.hpp>
#include <boost/intrusive/detail/mpl.hpp>
#include <boost/intrusive/detail/utilities.hpp>
#include <boost/intrusive/detail/tree_node.hpp>
namespace boost {
@@ -176,7 +175,7 @@ struct rbtree_node_traits_dispatch<VoidPointer, true>
: public compact_rbtree_node_traits_impl<VoidPointer>
{};
//Inherit from the detail::link_dispatch depending on the embedding capabilities
//Inherit from rbtree_node_traits_dispatch depending on the embedding capabilities
template<class VoidPointer, bool OptimizeSize = false>
struct rbtree_node_traits
: public rbtree_node_traits_dispatch

View File

@@ -0,0 +1,42 @@
/////////////////////////////////////////////////////////////////////////////
//
// (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_SIMPLE_DISPOSERS_HPP
#define BOOST_INTRUSIVE_DETAIL_SIMPLE_DISPOSERS_HPP
namespace boost {
namespace intrusive {
namespace detail {
class null_disposer
{
public:
template <class Pointer>
void operator()(Pointer)
{}
};
template<class NodeAlgorithms>
class init_disposer
{
typedef typename NodeAlgorithms::node_ptr node_ptr;
public:
void operator()(const node_ptr & p)
{ NodeAlgorithms::init(p); }
};
} //namespace detail{
} //namespace intrusive{
} //namespace boost{
#endif //BOOST_INTRUSIVE_DETAIL_SIMPLE_DISPOSERS_HPP

View File

@@ -0,0 +1,76 @@
/////////////////////////////////////////////////////////////////////////////
//
// (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_SIZE_HOLDER_HPP
#define BOOST_INTRUSIVE_DETAIL_SIZE_HOLDER_HPP
namespace boost {
namespace intrusive {
namespace detail {
template<bool ConstantSize, class SizeType, class Tag = void>
struct size_holder
{
static const bool constant_time_size = ConstantSize;
typedef SizeType size_type;
SizeType get_size() const
{ return size_; }
void set_size(SizeType size)
{ size_ = size; }
void decrement()
{ --size_; }
void increment()
{ ++size_; }
void increase(SizeType n)
{ size_ += n; }
void decrease(SizeType n)
{ size_ -= n; }
SizeType size_;
};
template<class SizeType, class Tag>
struct size_holder<false, SizeType, Tag>
{
static const bool constant_time_size = false;
typedef SizeType size_type;
size_type get_size() const
{ return 0; }
void set_size(size_type)
{}
void decrement()
{}
void increment()
{}
void increase(SizeType)
{}
void decrease(SizeType)
{}
};
} //namespace detail{
} //namespace intrusive{
} //namespace boost{
#endif //BOOST_INTRUSIVE_DETAIL_SIZE_HOLDER_HPP

View File

@@ -1,785 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
//
// (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_UTILITIES_HPP
#define BOOST_INTRUSIVE_DETAIL_UTILITIES_HPP
#include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/pointer_traits.hpp>
#include <boost/intrusive/detail/parent_from_member.hpp>
#include <boost/intrusive/detail/ebo_functor_holder.hpp>
#include <boost/intrusive/link_mode.hpp>
#include <boost/intrusive/detail/mpl.hpp>
#include <boost/intrusive/detail/assert.hpp>
#include <boost/intrusive/detail/is_stateful_value_traits.hpp>
#include <boost/intrusive/detail/algo_type.hpp>
#include <boost/intrusive/detail/to_raw_pointer.hpp>
#include <boost/intrusive/detail/std_fwd.hpp>
#include <boost/core/no_exceptions_support.hpp>
#include <cstddef>
namespace boost {
template<class T>
struct hash;
namespace intrusive {
template <link_mode_type link_mode>
struct is_safe_autounlink
{
static const bool value =
(int)link_mode == (int)auto_unlink ||
(int)link_mode == (int)safe_link;
};
namespace detail {
template <class T>
struct internal_member_value_traits
{
template <class U> static detail::one test(...);
template <class U> static detail::two test(typename U::member_value_traits* = 0);
static const bool value = sizeof(test<T>(0)) == sizeof(detail::two);
};
#define BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(TRAITS_PREFIX, TYPEDEF_TO_FIND) \
template <class T>\
struct TRAITS_PREFIX##_bool\
{\
template<bool Add>\
struct two_or_three {one _[2 + Add];};\
template <class U> static one test(...);\
template <class U> static two_or_three<U::TYPEDEF_TO_FIND> test (int);\
static const std::size_t value = sizeof(test<T>(0));\
};\
\
template <class T>\
struct TRAITS_PREFIX##_bool_is_true\
{\
static const bool value = TRAITS_PREFIX##_bool<T>::value > sizeof(one)*2;\
};\
//
BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(internal_base_hook, hooktags::is_base_hook)
BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(internal_any_hook, is_any_hook)
BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(resizable, resizable)
//This functor compares a stored value
//and the one passed as an argument
template<class ConstReference>
class equal_to_value
{
ConstReference t_;
public:
equal_to_value(ConstReference t)
: t_(t)
{}
bool operator()(ConstReference t)const
{ return t_ == t; }
};
class null_disposer
{
public:
template <class Pointer>
void operator()(Pointer)
{}
};
template<class NodeAlgorithms>
class init_disposer
{
typedef typename NodeAlgorithms::node_ptr node_ptr;
public:
void operator()(const node_ptr & p)
{ NodeAlgorithms::init(p); }
};
template<bool ConstantSize, class SizeType, class Tag = void>
struct size_holder
{
static const bool constant_time_size = ConstantSize;
typedef SizeType size_type;
SizeType get_size() const
{ return size_; }
void set_size(SizeType size)
{ size_ = size; }
void decrement()
{ --size_; }
void increment()
{ ++size_; }
void increase(SizeType n)
{ size_ += n; }
void decrease(SizeType n)
{ size_ -= n; }
SizeType size_;
};
template<class SizeType, class Tag>
struct size_holder<false, SizeType, Tag>
{
static const bool constant_time_size = false;
typedef SizeType size_type;
size_type get_size() const
{ return 0; }
void set_size(size_type)
{}
void decrement()
{}
void increment()
{}
void increase(SizeType)
{}
void decrease(SizeType)
{}
};
template<class KeyValueCompare, class ValueTraits>
struct key_nodeptr_comp
: private detail::ebo_functor_holder<KeyValueCompare>
{
typedef ValueTraits value_traits;
typedef typename value_traits::value_type value_type;
typedef typename value_traits::node_ptr node_ptr;
typedef typename value_traits::const_node_ptr const_node_ptr;
typedef detail::ebo_functor_holder<KeyValueCompare> base_t;
key_nodeptr_comp(KeyValueCompare kcomp, const ValueTraits *traits)
: base_t(kcomp), traits_(traits)
{}
template<class T>
struct is_node_ptr
{
static const bool value = is_same<T, const_node_ptr>::value || is_same<T, node_ptr>::value;
};
template<class T>
const value_type & key_forward
(const T &node, typename enable_if_c<is_node_ptr<T>::value>::type * = 0) const
{ return *traits_->to_value_ptr(node); }
template<class T>
const T & key_forward(const T &key, typename enable_if_c<!is_node_ptr<T>::value>::type* = 0) const
{ return key; }
template<class KeyType, class KeyType2>
bool operator()(const KeyType &key1, const KeyType2 &key2) const
{ return base_t::get()(this->key_forward(key1), this->key_forward(key2)); }
template<class KeyType>
bool operator()(const KeyType &key1) const
{ return base_t::get()(this->key_forward(key1)); }
const ValueTraits *const traits_;
};
template<class F, class ValueTraits, algo_types AlgoType>
struct node_cloner
: private detail::ebo_functor_holder<F>
{
typedef ValueTraits value_traits;
typedef typename value_traits::node_traits node_traits;
typedef typename node_traits::node_ptr node_ptr;
typedef detail::ebo_functor_holder<F> base_t;
typedef typename get_algo< AlgoType
, node_traits>::type node_algorithms;
static const bool safemode_or_autounlink =
is_safe_autounlink<value_traits::link_mode>::value;
typedef typename value_traits::value_type value_type;
typedef typename value_traits::pointer pointer;
typedef typename node_traits::node node;
typedef typename value_traits::const_node_ptr const_node_ptr;
typedef typename value_traits::reference reference;
typedef typename value_traits::const_reference const_reference;
node_cloner(F f, const ValueTraits *traits)
: base_t(f), traits_(traits)
{}
// tree-based containers use this method, which is proxy-reference friendly
node_ptr operator()(const node_ptr & p)
{
const_reference v = *traits_->to_value_ptr(p);
node_ptr n = traits_->to_node_ptr(*base_t::get()(v));
//Cloned node must be in default mode if the linking mode requires it
if(safemode_or_autounlink)
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(n));
return n;
}
// hashtables use this method, which is proxy-reference unfriendly
node_ptr operator()(const node &to_clone)
{
const value_type &v =
*traits_->to_value_ptr
(pointer_traits<const_node_ptr>::pointer_to(to_clone));
node_ptr n = traits_->to_node_ptr(*base_t::get()(v));
//Cloned node must be in default mode if the linking mode requires it
if(safemode_or_autounlink)
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(n));
return n;
}
const ValueTraits * const traits_;
};
template<class F, class ValueTraits, algo_types AlgoType>
struct node_disposer
: private detail::ebo_functor_holder<F>
{
typedef ValueTraits value_traits;
typedef typename value_traits::node_traits node_traits;
typedef typename node_traits::node_ptr node_ptr;
typedef detail::ebo_functor_holder<F> base_t;
typedef typename get_algo< AlgoType
, node_traits>::type node_algorithms;
static const bool safemode_or_autounlink =
is_safe_autounlink<value_traits::link_mode>::value;
node_disposer(F f, const ValueTraits *cont)
: base_t(f), traits_(cont)
{}
void operator()(const node_ptr & p)
{
if(safemode_or_autounlink)
node_algorithms::init(p);
base_t::get()(traits_->to_value_ptr(p));
}
const ValueTraits * const traits_;
};
template<class ValueTraits>
struct empty_node_checker
{
typedef ValueTraits value_traits;
typedef typename value_traits::node_traits node_traits;
typedef typename node_traits::const_node_ptr const_node_ptr;
struct return_type {};
void operator () (const const_node_ptr&, const return_type&, const return_type&, return_type&) {}
};
template<class VoidPointer>
struct dummy_constptr
{
typedef typename boost::intrusive::pointer_traits<VoidPointer>::
template rebind_pointer<const void>::type ConstVoidPtr;
explicit dummy_constptr(ConstVoidPtr)
{}
dummy_constptr()
{}
ConstVoidPtr get_ptr() const
{ return ConstVoidPtr(); }
};
template<class VoidPointer>
struct constptr
{
typedef typename boost::intrusive::pointer_traits<VoidPointer>::
template rebind_pointer<const void>::type ConstVoidPtr;
constptr()
{}
explicit constptr(const ConstVoidPtr &ptr)
: const_void_ptr_(ptr)
{}
const void *get_ptr() const
{ return boost::intrusive::detail::to_raw_pointer(const_void_ptr_); }
ConstVoidPtr const_void_ptr_;
};
template <class VoidPointer, bool store_ptr>
struct select_constptr
{
typedef typename detail::if_c
< store_ptr
, constptr<VoidPointer>
, dummy_constptr<VoidPointer>
>::type type;
};
template<class T, bool Add>
struct add_const_if_c
{
typedef typename detail::if_c
< Add
, typename detail::add_const<T>::type
, T
>::type type;
};
template <link_mode_type LinkMode>
struct link_dispatch
{};
template<class Hook>
void destructor_impl(Hook &hook, detail::link_dispatch<safe_link>)
{ //If this assertion raises, you might have destroyed an object
//while it was still inserted in a container that is alive.
//If so, remove the object from the container before destroying it.
(void)hook; BOOST_INTRUSIVE_SAFE_HOOK_DESTRUCTOR_ASSERT(!hook.is_linked());
}
template<class Hook>
void destructor_impl(Hook &hook, detail::link_dispatch<auto_unlink>)
{ hook.unlink(); }
template<class Hook>
void destructor_impl(Hook &, detail::link_dispatch<normal_link>)
{}
template<class Container, class Disposer>
class exception_disposer
{
Container *cont_;
Disposer &disp_;
exception_disposer(const exception_disposer&);
exception_disposer &operator=(const exception_disposer&);
public:
exception_disposer(Container &cont, Disposer &disp)
: cont_(&cont), disp_(disp)
{}
void release()
{ cont_ = 0; }
~exception_disposer()
{
if(cont_){
cont_->clear_and_dispose(disp_);
}
}
};
template<class Container, class Disposer, class SizeType>
class exception_array_disposer
{
Container *cont_;
Disposer &disp_;
SizeType &constructed_;
exception_array_disposer(const exception_array_disposer&);
exception_array_disposer &operator=(const exception_array_disposer&);
public:
exception_array_disposer
(Container &cont, Disposer &disp, SizeType &constructed)
: cont_(&cont), disp_(disp), constructed_(constructed)
{}
void release()
{ cont_ = 0; }
~exception_array_disposer()
{
SizeType n = constructed_;
if(cont_){
while(n--){
cont_[n].clear_and_dispose(disp_);
}
}
}
};
template<class ValueTraits, bool IsConst>
struct node_to_value
: public detail::select_constptr
< typename pointer_traits
<typename ValueTraits::pointer>::template rebind_pointer<void>::type
, is_stateful_value_traits<ValueTraits>::value
>::type
{
static const bool stateful_value_traits = is_stateful_value_traits<ValueTraits>::value;
typedef typename detail::select_constptr
< typename pointer_traits
<typename ValueTraits::pointer>::
template rebind_pointer<void>::type
, stateful_value_traits >::type Base;
typedef ValueTraits value_traits;
typedef typename value_traits::value_type value_type;
typedef typename value_traits::node_traits::node node;
typedef typename detail::add_const_if_c
<value_type, IsConst>::type vtype;
typedef typename detail::add_const_if_c
<node, IsConst>::type ntype;
typedef typename pointer_traits
<typename ValueTraits::pointer>::
template rebind_pointer<ntype>::type npointer;
typedef typename pointer_traits<npointer>::
template rebind_pointer<const ValueTraits>::type const_value_traits_ptr;
node_to_value(const const_value_traits_ptr &ptr)
: Base(ptr)
{}
typedef vtype & result_type;
typedef ntype & first_argument_type;
const_value_traits_ptr get_value_traits() const
{ return pointer_traits<const_value_traits_ptr>::static_cast_from(Base::get_ptr()); }
result_type to_value(first_argument_type arg, false_) const
{ return *(value_traits::to_value_ptr(pointer_traits<npointer>::pointer_to(arg))); }
result_type to_value(first_argument_type arg, true_) const
{ return *(this->get_value_traits()->to_value_ptr(pointer_traits<npointer>::pointer_to(arg))); }
result_type operator()(first_argument_type arg) const
{ return this->to_value(arg, bool_<stateful_value_traits>()); }
};
//This is not standard, but should work with all compilers
union max_align
{
char char_;
short short_;
int int_;
long long_;
#ifdef BOOST_HAS_LONG_LONG
long long long_long_;
#endif
float float_;
double double_;
long double long_double_;
void * void_ptr_;
};
template<class T, std::size_t N>
class array_initializer
{
public:
template<class CommonInitializer>
array_initializer(const CommonInitializer &init)
{
char *init_buf = (char*)rawbuf;
std::size_t i = 0;
BOOST_TRY{
for(; i != N; ++i){
new(init_buf)T(init);
init_buf += sizeof(T);
}
}
BOOST_CATCH(...){
while(i--){
init_buf -= sizeof(T);
((T*)init_buf)->~T();
}
BOOST_RETHROW;
}
BOOST_CATCH_END
}
operator T* ()
{ return (T*)(rawbuf); }
operator const T*() const
{ return (const T*)(rawbuf); }
~array_initializer()
{
char *init_buf = (char*)rawbuf + N*sizeof(T);
for(std::size_t i = 0; i != N; ++i){
init_buf -= sizeof(T);
((T*)init_buf)->~T();
}
}
private:
detail::max_align rawbuf[(N*sizeof(T)-1)/sizeof(detail::max_align)+1];
};
} //namespace detail
template<class Node, class Tag, unsigned int>
struct node_holder
: public Node
{};
template<class T, class NodePtr, class Tag, unsigned int Type>
struct bhtraits_base
{
public:
typedef NodePtr node_ptr;
typedef typename pointer_traits<node_ptr>::element_type node;
typedef node_holder<node, Tag, Type> node_holder_type;
typedef T value_type;
typedef typename pointer_traits<node_ptr>::
template rebind_pointer<const node>::type const_node_ptr;
typedef typename pointer_traits<node_ptr>::
template rebind_pointer<T>::type pointer;
typedef typename pointer_traits<node_ptr>::
template rebind_pointer<const T>::type const_pointer;
//typedef typename pointer_traits<pointer>::reference reference;
//typedef typename pointer_traits<const_pointer>::reference const_reference;
typedef T & reference;
typedef const T & const_reference;
typedef node_holder_type & node_holder_reference;
typedef const node_holder_type & const_node_holder_reference;
typedef node& node_reference;
typedef const node & const_node_reference;
static pointer to_value_ptr(const node_ptr & n)
{
return pointer_traits<pointer>::pointer_to
(static_cast<reference>(static_cast<node_holder_reference>(*n)));
}
static const_pointer to_value_ptr(const const_node_ptr & n)
{
return pointer_traits<const_pointer>::pointer_to
(static_cast<const_reference>(static_cast<const_node_holder_reference>(*n)));
}
static node_ptr to_node_ptr(reference value)
{
return pointer_traits<node_ptr>::pointer_to
(static_cast<node_reference>(static_cast<node_holder_reference>(value)));
}
static const_node_ptr to_node_ptr(const_reference value)
{
return pointer_traits<const_node_ptr>::pointer_to
(static_cast<const_node_reference>(static_cast<const_node_holder_reference>(value)));
}
};
template<class T, class NodeTraits, link_mode_type LinkMode, class Tag, unsigned int Type>
struct bhtraits
: public bhtraits_base<T, typename NodeTraits::node_ptr, Tag, Type>
{
static const link_mode_type link_mode = LinkMode;
typedef NodeTraits node_traits;
};
/*
template<class T, class NodePtr, typename pointer_traits<NodePtr>::element_type T::* P>
struct mhtraits_base
{
public:
typedef typename pointer_traits<NodePtr>::element_type node;
typedef T value_type;
typedef NodePtr node_ptr;
typedef typename pointer_traits<node_ptr>::
template rebind_pointer<const node>::type const_node_ptr;
typedef typename pointer_traits<node_ptr>::
template rebind_pointer<T>::type pointer;
typedef typename pointer_traits<node_ptr>::
template rebind_pointer<const T>::type const_pointer;
typedef T & reference;
typedef const T & const_reference;
typedef node& node_reference;
typedef const node & const_node_reference;
static node_ptr to_node_ptr(reference value)
{
return pointer_traits<node_ptr>::pointer_to
(static_cast<node_reference>(value.*P));
}
static const_node_ptr to_node_ptr(const_reference value)
{
return pointer_traits<const_node_ptr>::pointer_to
(static_cast<const_node_reference>(value.*P));
}
static pointer to_value_ptr(const node_ptr & n)
{
return pointer_traits<pointer>::pointer_to
(*detail::parent_from_member<T, node>
(boost::intrusive::detail::to_raw_pointer(n), P));
}
static const_pointer to_value_ptr(const const_node_ptr & n)
{
return pointer_traits<const_pointer>::pointer_to
(*detail::parent_from_member<T, node>
(boost::intrusive::detail::to_raw_pointer(n), P));
}
};
template<class T, class NodeTraits, typename NodeTraits::node T::* P, link_mode_type LinkMode>
struct mhtraits
: public mhtraits_base<T, typename NodeTraits::node_ptr, P>
{
static const link_mode_type link_mode = LinkMode;
typedef NodeTraits node_traits;
};
*/
template<class T, class Hook, Hook T::* P>
struct mhtraits
{
public:
typedef Hook hook_type;
typedef typename hook_type::hooktags::node_traits node_traits;
typedef typename node_traits::node node;
typedef T value_type;
typedef typename node_traits::node_ptr node_ptr;
typedef typename node_traits::const_node_ptr const_node_ptr;
typedef typename pointer_traits<node_ptr>::
template rebind_pointer<T>::type pointer;
typedef typename pointer_traits<node_ptr>::
template rebind_pointer<const T>::type const_pointer;
typedef T & reference;
typedef const T & const_reference;
typedef node& node_reference;
typedef const node & const_node_reference;
typedef hook_type& hook_reference;
typedef const hook_type & const_hook_reference;
static const link_mode_type link_mode = Hook::hooktags::link_mode;
static node_ptr to_node_ptr(reference value)
{
return pointer_traits<node_ptr>::pointer_to
(static_cast<node_reference>(static_cast<hook_reference>(value.*P)));
}
static const_node_ptr to_node_ptr(const_reference value)
{
return pointer_traits<const_node_ptr>::pointer_to
(static_cast<const_node_reference>(static_cast<const_hook_reference>(value.*P)));
}
static pointer to_value_ptr(const node_ptr & n)
{
return pointer_traits<pointer>::pointer_to
(*detail::parent_from_member<T, Hook>
(static_cast<Hook*>(boost::intrusive::detail::to_raw_pointer(n)), P));
}
static const_pointer to_value_ptr(const const_node_ptr & n)
{
return pointer_traits<const_pointer>::pointer_to
(*detail::parent_from_member<T, Hook>
(static_cast<const Hook*>(boost::intrusive::detail::to_raw_pointer(n)), P));
}
};
template<class Functor>
struct fhtraits
{
public:
typedef typename Functor::hook_type hook_type;
typedef typename Functor::hook_ptr hook_ptr;
typedef typename Functor::const_hook_ptr const_hook_ptr;
typedef typename hook_type::hooktags::node_traits node_traits;
typedef typename node_traits::node node;
typedef typename Functor::value_type value_type;
typedef typename node_traits::node_ptr node_ptr;
typedef typename node_traits::const_node_ptr const_node_ptr;
typedef typename pointer_traits<node_ptr>::
template rebind_pointer<value_type>::type pointer;
typedef typename pointer_traits<node_ptr>::
template rebind_pointer<const value_type>::type const_pointer;
typedef value_type & reference;
typedef const value_type & const_reference;
static const link_mode_type link_mode = hook_type::hooktags::link_mode;
static node_ptr to_node_ptr(reference value)
{ return static_cast<node*>(boost::intrusive::detail::to_raw_pointer(Functor::to_hook_ptr(value))); }
static const_node_ptr to_node_ptr(const_reference value)
{ return static_cast<const node*>(boost::intrusive::detail::to_raw_pointer(Functor::to_hook_ptr(value))); }
static pointer to_value_ptr(const node_ptr & n)
{ return Functor::to_value_ptr(to_hook_ptr(n)); }
static const_pointer to_value_ptr(const const_node_ptr & n)
{ return Functor::to_value_ptr(to_hook_ptr(n)); }
private:
static hook_ptr to_hook_ptr(const node_ptr & n)
{ return hook_ptr(&*static_cast<hook_type*>(&*n)); }
static const_hook_ptr to_hook_ptr(const const_node_ptr & n)
{ return const_hook_ptr(&*static_cast<const hook_type*>(&*n)); }
};
template<class Less, class T>
struct get_less
{
typedef Less type;
};
template<class T>
struct get_less<void, T>
{
typedef ::std::less<T> type;
};
template<class EqualTo, class T>
struct get_equal_to
{
typedef EqualTo type;
};
template<class T>
struct get_equal_to<void, T>
{
typedef ::std::equal_to<T> type;
};
template<class Hash, class T>
struct get_hash
{
typedef Hash type;
};
template<class T>
struct get_hash<void, T>
{
typedef ::boost::hash<T> type;
};
struct empty{};
} //namespace intrusive
} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
#endif //BOOST_INTRUSIVE_DETAIL_UTILITIES_HPP

View File

@@ -28,8 +28,13 @@
#include <boost/intrusive/detail/transform_iterator.hpp>
#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>
#include <boost/intrusive/detail/node_to_value.hpp>
#include <boost/intrusive/detail/exception_disposer.hpp>
#include <boost/intrusive/detail/node_cloner_disposer.hpp>
#include <boost/intrusive/detail/simple_disposers.hpp>
#include <boost/intrusive/detail/size_holder.hpp>
//Implementation utilities
#include <boost/intrusive/unordered_set_hook.hpp>
#include <boost/intrusive/slist.hpp>
@@ -767,6 +772,18 @@ struct bucket_plus_vtraits : public ValueTraits
bucket_traits bucket_traits_;
};
template<class Hash, class T>
struct get_hash
{
typedef Hash type;
};
template<class T>
struct get_hash<void, T>
{
typedef ::boost::hash<T> type;
};
//bucket_hash_t
//Stores bucket_plus_vtraits plust the hash function
template<class VoidOrKeyHash, class ValueTraits, class BucketTraits>
@@ -804,6 +821,20 @@ struct bucket_hash_t
bucket_plus_vtraits_t internal; //4
};
template<class EqualTo, class T>
struct get_equal_to
{
typedef EqualTo type;
};
template<class T>
struct get_equal_to<void, T>
{
typedef ::std::equal_to<T> type;
};
//bucket_hash_equal_t
//Stores bucket_hash_t and the equality function when the first
//non-empty bucket shall not be cached.

View File

@@ -40,6 +40,19 @@ enum link_mode_type{
//!the container without using any function provided by the containers.
auto_unlink
};
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
template <link_mode_type link_mode>
struct is_safe_autounlink
{
static const bool value =
(int)link_mode == (int)auto_unlink ||
(int)link_mode == (int)safe_link;
};
#endif //BOOST_INTRUSIVE_DOXYGEN_INVOKED
} //namespace intrusive
} //namespace boost

View File

@@ -22,18 +22,25 @@
#include <boost/intrusive/pointer_traits.hpp>
#include <boost/intrusive/detail/mpl.hpp>
#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 <boost/intrusive/detail/array_initializer.hpp>
#include <boost/intrusive/detail/exception_disposer.hpp>
#include <boost/intrusive/detail/equal_to_value.hpp>
#include <boost/intrusive/detail/key_nodeptr_comp.hpp>
#include <boost/intrusive/detail/simple_disposers.hpp>
#include <boost/intrusive/detail/size_holder.hpp>
#include <boost/move/utility_core.hpp>
#include <boost/static_assert.hpp>
#include <algorithm>
#include <functional>
#include <cstddef>
#include <boost/move/utility_core.hpp>
namespace boost {
namespace intrusive {

View File

@@ -16,7 +16,7 @@
#include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/intrusive_fwd.hpp>
#include <boost/intrusive/detail/utilities.hpp>
#include <boost/intrusive/detail/list_node.hpp>
#include <boost/intrusive/circular_list_algorithms.hpp>
#include <boost/intrusive/options.hpp>
@@ -25,14 +25,6 @@
namespace boost {
namespace intrusive {
/// @cond
template<class VoidPointer>
struct get_list_node_algo
{
typedef circular_list_algorithms<list_node_traits<VoidPointer> > type;
};
/// @endcond
//! Helper metafunction to define a \c \c list_base_hook that yields to the same
//! type when the same options (either explicitly or implicitly) are used.
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
@@ -53,7 +45,7 @@ struct make_list_base_hook
>::type packed_options;
typedef generic_hook
< get_list_node_algo<typename packed_options::void_pointer>
< circular_list_algorithms<list_node_traits<typename packed_options::void_pointer> >
, typename packed_options::tag
, packed_options::link_mode
, ListBaseHookId
@@ -180,7 +172,7 @@ struct make_list_member_hook
>::type packed_options;
typedef generic_hook
< get_list_node_algo<typename packed_options::void_pointer>
< circular_list_algorithms<list_node_traits<typename packed_options::void_pointer> >
, member_tag
, packed_options::link_mode
, NoBaseHookId

View File

@@ -18,7 +18,7 @@
#include <boost/intrusive/link_mode.hpp>
#include <boost/intrusive/pack_options.hpp>
#include <boost/intrusive/detail/mpl.hpp>
#include <boost/intrusive/detail/utilities.hpp>
#include <boost/intrusive/detail/hook_traits.hpp>
#include <boost/static_assert.hpp>
namespace boost {
@@ -90,10 +90,13 @@ template <class BaseHook>
struct any_hook_base_node_traits
{ typedef typename BaseHook::node_traits type; };
BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(internal_any_hook, is_any_hook)
template<class T, class BaseHook>
struct get_base_value_traits
{
typedef typename detail::eval_if_c
typedef typename eval_if_c
< internal_any_hook_bool_is_true<BaseHook>::value
, any_hook_base_value_traits<T, BaseHook>
, concrete_hook_base_value_traits<T, BaseHook>
@@ -103,7 +106,7 @@ struct get_base_value_traits
template<class BaseHook>
struct get_base_node_traits
{
typedef typename detail::eval_if_c
typedef typename eval_if_c
< internal_any_hook_bool_is_true<BaseHook>::value
, any_hook_base_node_traits<BaseHook>
, concrete_hook_base_node_traits<BaseHook>
@@ -122,27 +125,37 @@ struct get_member_node_traits
typedef typename MemberHook::member_value_traits::node_traits type;
};
template <class T>
struct internal_member_value_traits
{
template <class U> static one test(...);
template <class U> static two test(typename U::member_value_traits* = 0);
static const bool value = sizeof(test<T>(0)) == sizeof(two);
};
BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(internal_base_hook, hooktags::is_base_hook)
template<class T, class SupposedValueTraits>
struct get_value_traits
{
typedef typename detail::eval_if_c
<detail::is_convertible<SupposedValueTraits*, detail::default_hook_tag*>::value
,detail::apply<SupposedValueTraits, T>
,detail::identity<SupposedValueTraits>
typedef typename eval_if_c
<is_convertible<SupposedValueTraits*, default_hook_tag*>::value
,apply<SupposedValueTraits, T>
,identity<SupposedValueTraits>
>::type supposed_value_traits;
//...if it's a default hook
typedef typename detail::eval_if_c
typedef typename eval_if_c
< internal_base_hook_bool_is_true<supposed_value_traits>::value
//...get it's internal value traits using
//the provided T value type.
, get_base_value_traits<T, supposed_value_traits>
//...else use its internal value traits tag
//(member hooks and custom value traits are in this group)
, detail::eval_if_c
, eval_if_c
< internal_member_value_traits<supposed_value_traits>::value
, get_member_value_traits<T, supposed_value_traits>
, detail::identity<supposed_value_traits>
, identity<supposed_value_traits>
>
>::type type;
};
@@ -158,14 +171,14 @@ struct get_node_traits
{
typedef SupposedValueTraits supposed_value_traits;
//...if it's a base hook
typedef typename detail::eval_if_c
typedef typename eval_if_c
< internal_base_hook_bool_is_true<supposed_value_traits>::value
//...get it's internal value traits using
//the provided T value type.
, get_base_node_traits<supposed_value_traits>
//...else use its internal value traits tag
//(member hooks and custom value traits are in this group)
, detail::eval_if_c
, eval_if_c
< internal_member_value_traits<supposed_value_traits>::value
, get_member_node_traits<supposed_value_traits>
, get_explicit_node_traits<supposed_value_traits>

View File

@@ -18,19 +18,18 @@
#include <functional>
#include <utility>
#include <boost/intrusive/detail/assert.hpp>
#include <boost/static_assert.hpp>
#include <boost/intrusive/set_hook.hpp>
#include <boost/intrusive/detail/rbtree_node.hpp>
#include <boost/intrusive/bstree.hpp>
#include <boost/intrusive/detail/tree_node.hpp>
#include <boost/intrusive/detail/mpl.hpp>
#include <boost/intrusive/pointer_traits.hpp>
#include <boost/intrusive/detail/utilities.hpp>
#include <boost/intrusive/options.hpp>
#include <boost/intrusive/rbtree_algorithms.hpp>
#include <boost/intrusive/link_mode.hpp>
#include <boost/move/utility_core.hpp>
#include <boost/static_assert.hpp>
namespace boost {
namespace intrusive {

View File

@@ -423,7 +423,7 @@ class rbtree_algorithms
const node_ptr x_parent_left(NodeTraits::get_left(x_parent));
if(x == x_parent_left){ //x is left child
node_ptr w = NodeTraits::get_right(x_parent);
BOOST_ASSERT(w);
BOOST_INTRUSIVE_INVARIANT_ASSERT(w);
if(NodeTraits::get_color(w) == NodeTraits::red()){
NodeTraits::set_color(w, NodeTraits::black());
NodeTraits::set_color(x_parent, NodeTraits::red());

View File

@@ -17,7 +17,6 @@
#include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/intrusive_fwd.hpp>
#include <boost/intrusive/detail/utilities.hpp>
#include <boost/intrusive/detail/rbtree_node.hpp>
#include <boost/intrusive/rbtree_algorithms.hpp>
#include <boost/intrusive/options.hpp>
@@ -26,14 +25,6 @@
namespace boost {
namespace intrusive {
/// @cond
template<class VoidPointer, bool OptimizeSize = false>
struct get_set_node_algo
{
typedef rbtree_algorithms<rbtree_node_traits<VoidPointer, OptimizeSize> > type;
};
/// @endcond
//! Helper metafunction to define a \c set_base_hook that yields to the same
//! type when the same options (either explicitly or implicitly) are used.
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
@@ -54,8 +45,7 @@ struct make_set_base_hook
>::type packed_options;
typedef generic_hook
< get_set_node_algo<typename packed_options::void_pointer
,packed_options::optimize_size>
< rbtree_algorithms<rbtree_node_traits<typename packed_options::void_pointer, packed_options::optimize_size> >
, typename packed_options::tag
, packed_options::link_mode
, RbTreeBaseHookId
@@ -186,8 +176,7 @@ struct make_set_member_hook
>::type packed_options;
typedef generic_hook
< get_set_node_algo<typename packed_options::void_pointer
,packed_options::optimize_size>
< rbtree_algorithms<rbtree_node_traits<typename packed_options::void_pointer, packed_options::optimize_size> >
, member_tag
, packed_options::link_mode
, NoBaseHookId

View File

@@ -33,10 +33,10 @@
#include <boost/intrusive/detail/tree_node.hpp>
#include <boost/intrusive/pointer_traits.hpp>
#include <boost/intrusive/detail/mpl.hpp>
#include <boost/intrusive/detail/utilities.hpp>
#include <boost/intrusive/detail/math.hpp>
#include <boost/intrusive/options.hpp>
#include <boost/intrusive/sgtree_algorithms.hpp>
#include <boost/intrusive/detail/key_nodeptr_comp.hpp>
#include <boost/intrusive/link_mode.hpp>
#include <boost/move/utility_core.hpp>

View File

@@ -21,7 +21,6 @@
#include <boost/intrusive/intrusive_fwd.hpp>
#include <cstddef>
#include <boost/intrusive/detail/assert.hpp>
#include <boost/intrusive/detail/algo_type.hpp>
#include <boost/intrusive/bstree_algorithms.hpp>

View File

@@ -16,7 +16,7 @@
#include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/intrusive_fwd.hpp>
#include <boost/static_assert.hpp>
#include <boost/intrusive/detail/assert.hpp>
#include <boost/intrusive/slist_hook.hpp>
#include <boost/intrusive/circular_slist_algorithms.hpp>
@@ -25,16 +25,24 @@
#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 <boost/intrusive/detail/array_initializer.hpp>
#include <boost/intrusive/detail/exception_disposer.hpp>
#include <boost/intrusive/detail/equal_to_value.hpp>
#include <boost/intrusive/detail/key_nodeptr_comp.hpp>
#include <boost/intrusive/detail/simple_disposers.hpp>
#include <boost/intrusive/detail/size_holder.hpp>
#include <boost/move/utility_core.hpp>
#include <boost/static_assert.hpp>
#include <functional>
#include <algorithm>
#include <cstddef> //std::size_t
#include <utility> //std::pair
#include <boost/move/utility_core.hpp>
namespace boost {
namespace intrusive {

View File

@@ -16,7 +16,7 @@
#include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/intrusive_fwd.hpp>
#include <boost/intrusive/detail/utilities.hpp>
#include <boost/intrusive/detail/slist_node.hpp>
#include <boost/intrusive/circular_slist_algorithms.hpp>
#include <boost/intrusive/link_mode.hpp>
@@ -26,15 +26,6 @@
namespace boost {
namespace intrusive {
/// @cond
template<class VoidPointer>
struct get_slist_node_algo
{
typedef circular_slist_algorithms<slist_node_traits<VoidPointer> > type;
};
/// @endcond
//! Helper metafunction to define a \c slist_base_hook that yields to the same
//! type when the same options (either explicitly or implicitly) are used.
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
@@ -55,7 +46,7 @@ struct make_slist_base_hook
>::type packed_options;
typedef generic_hook
< get_slist_node_algo<typename packed_options::void_pointer>
< circular_slist_algorithms<slist_node_traits<typename packed_options::void_pointer> >
, typename packed_options::tag
, packed_options::link_mode
, SlistBaseHookId
@@ -183,7 +174,7 @@ struct make_slist_member_hook
>::type packed_options;
typedef generic_hook
< get_slist_node_algo<typename packed_options::void_pointer>
< circular_slist_algorithms<slist_node_traits<typename packed_options::void_pointer> >
, member_tag
, packed_options::link_mode
, NoBaseHookId

View File

@@ -18,17 +18,16 @@
#include <functional>
#include <utility>
#include <boost/intrusive/detail/assert.hpp>
#include <boost/static_assert.hpp>
#include <boost/intrusive/bstree.hpp>
#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/splaytree_algorithms.hpp>
#include <boost/intrusive/link_mode.hpp>
#include <boost/intrusive/detail/key_nodeptr_comp.hpp>
#include <boost/move/utility_core.hpp>
namespace boost {

View File

@@ -33,11 +33,12 @@
#include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/intrusive_fwd.hpp>
#include <boost/intrusive/detail/assert.hpp>
#include <cstddef>
#include <boost/intrusive/detail/algo_type.hpp>
#include <boost/intrusive/detail/uncast.hpp>
#include <boost/intrusive/bstree_algorithms.hpp>
#include <cstddef>
namespace boost {
namespace intrusive {

View File

@@ -25,7 +25,6 @@
#include <boost/intrusive/bstree.hpp>
#include <boost/intrusive/detail/tree_node.hpp>
#include <boost/intrusive/detail/ebo_functor_holder.hpp>
#include <boost/intrusive/detail/utilities.hpp>
#include <boost/intrusive/pointer_traits.hpp>
#include <boost/intrusive/options.hpp>
#include <boost/intrusive/detail/mpl.hpp>
@@ -33,6 +32,8 @@
#include <boost/intrusive/link_mode.hpp>
#include <boost/move/utility_core.hpp>
#include <boost/intrusive/priority_compare.hpp>
#include <boost/intrusive/detail/node_cloner_disposer.hpp>
#include <boost/intrusive/detail/key_nodeptr_comp.hpp>
namespace boost {
namespace intrusive {

View File

@@ -16,7 +16,7 @@
#include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/intrusive_fwd.hpp>
#include <boost/intrusive/detail/utilities.hpp>
#include <boost/intrusive/pointer_traits.hpp>
#include <boost/intrusive/slist_hook.hpp>
#include <boost/intrusive/options.hpp>
@@ -142,6 +142,11 @@ struct unordered_algorithms
}
};
//Class to avoid defining the same algo as a circular list, as hooks would be ambiguous between them
template<class Algo>
struct uset_algo_wrapper : public Algo
{};
template<class VoidPointer, bool StoreHash, bool OptimizeMultiKey>
struct get_uset_node_algo
{
@@ -151,9 +156,9 @@ struct get_uset_node_algo
, slist_node_traits<VoidPointer>
>::type node_traits_type;
typedef typename detail::if_c
< OptimizeMultiKey
, unordered_algorithms<node_traits_type>
, circular_slist_algorithms<node_traits_type>
< OptimizeMultiKey
, unordered_algorithms<node_traits_type>
, uset_algo_wrapper< circular_slist_algorithms<node_traits_type> >
>::type type;
};
/// @endcond
@@ -178,10 +183,10 @@ struct make_unordered_set_base_hook
>::type packed_options;
typedef generic_hook
< get_uset_node_algo<typename packed_options::void_pointer
, packed_options::store_hash
, packed_options::optimize_multikey
>
< typename get_uset_node_algo < typename packed_options::void_pointer
, packed_options::store_hash
, packed_options::optimize_multikey
>::type
, typename packed_options::tag
, packed_options::link_mode
, HashBaseHookId
@@ -317,10 +322,10 @@ struct make_unordered_set_member_hook
>::type packed_options;
typedef generic_hook
< get_uset_node_algo< typename packed_options::void_pointer
, packed_options::store_hash
, packed_options::optimize_multikey
>
< typename get_uset_node_algo< typename packed_options::void_pointer
, packed_options::store_hash
, packed_options::optimize_multikey
>::type
, member_tag
, packed_options::link_mode
, NoBaseHookId

View File

@@ -235,6 +235,9 @@
<File
RelativePath="..\..\..\..\..\boost\intrusive\detail\any_node_and_algorithms.hpp">
</File>
<File
RelativePath="..\..\..\..\..\boost\intrusive\detail\array_initializer.hpp">
</File>
<File
RelativePath="..\..\..\..\..\boost\intrusive\detail\assert.hpp">
</File>
@@ -253,6 +256,15 @@
<File
RelativePath="..\..\..\..\..\boost\intrusive\detail\ebo_functor_holder.hpp">
</File>
<File
RelativePath="..\..\..\..\..\boost\intrusive\detail\empty_node_checker.hpp">
</File>
<File
RelativePath="..\..\..\..\..\boost\intrusive\detail\equal_to_value.hpp">
</File>
<File
RelativePath="..\..\..\..\..\boost\intrusive\detail\exception_disposer.hpp">
</File>
<File
RelativePath="..\..\..\..\..\boost\intrusive\detail\function_detector.hpp">
</File>
@@ -265,12 +277,18 @@
<File
RelativePath="..\..\..\..\..\boost\intrusive\detail\hashtable_node.hpp">
</File>
<File
RelativePath="..\..\..\..\..\boost\intrusive\detail\hook_traits.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\key_nodeptr_comp.hpp">
</File>
<File
RelativePath="..\..\..\..\..\boost\intrusive\detail\list_iterator.hpp">
</File>
@@ -286,6 +304,15 @@
<File
RelativePath="..\..\..\..\..\boost\intrusive\detail\mpl.hpp">
</File>
<File
RelativePath="..\..\..\..\..\boost\intrusive\detail\node_cloner_disposer.hpp">
</File>
<File
RelativePath="..\..\..\..\..\boost\intrusive\detail\node_holder.hpp">
</File>
<File
RelativePath="..\..\..\..\..\boost\intrusive\detail\node_to_value.hpp">
</File>
<File
RelativePath="..\..\..\..\..\boost\intrusive\detail\parent_from_member.hpp">
</File>
@@ -298,6 +325,12 @@
<File
RelativePath="..\..\..\..\..\boost\intrusive\detail\rbtree_node.hpp">
</File>
<File
RelativePath="..\..\..\..\..\boost\intrusive\detail\simple_disposers.hpp">
</File>
<File
RelativePath="..\..\..\..\..\boost\intrusive\detail\size_holder.hpp">
</File>
<File
RelativePath="..\..\..\..\..\boost\intrusive\detail\slist_iterator.hpp">
</File>
@@ -322,9 +355,6 @@
<File
RelativePath="..\..\..\..\..\boost\intrusive\detail\uncast.hpp">
</File>
<File
RelativePath="..\..\..\..\..\boost\intrusive\detail\utilities.hpp">
</File>
<File
RelativePath="..\..\..\..\..\boost\intrusive\detail\workaround.hpp">
</File>

View File

@@ -19,6 +19,7 @@
#include <boost/container/vector.hpp>
#include <boost/intrusive/detail/mpl.hpp>
#include <boost/intrusive/pointer_traits.hpp>
#include <boost/core/no_exceptions_support.hpp>
template < typename T >
class bounded_pointer;

View File

@@ -13,7 +13,7 @@
#ifndef BOOST_INTRUSIVE_TEST_COMMON_FUNCTORS_HPP
#define BOOST_INTRUSIVE_TEST_COMMON_FUNCTORS_HPP
#include<boost/intrusive/detail/utilities.hpp>
#include<boost/intrusive/detail/iiterator.hpp>
#include<boost/intrusive/detail/mpl.hpp>
#include<boost/static_assert.hpp>

View File

@@ -15,7 +15,6 @@
#include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/pointer_traits.hpp>
#include <boost/intrusive/detail/utilities.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <boost/static_assert.hpp>

View File

@@ -15,6 +15,7 @@
#include <boost/detail/lightweight_test.hpp>
#include <boost/intrusive/detail/mpl.hpp>
#include <boost/intrusive/detail/simple_disposers.hpp>
#include <boost/move/utility_core.hpp>
namespace boost {