diff options
Diffstat (limited to 'boost/intrusive/detail')
-rw-r--r-- | boost/intrusive/detail/default_header_holder.hpp | 4 | ||||
-rw-r--r-- | boost/intrusive/detail/ebo_functor_holder.hpp | 2 | ||||
-rw-r--r-- | boost/intrusive/detail/hashtable_node.hpp | 2 | ||||
-rw-r--r-- | boost/intrusive/detail/hook_traits.hpp | 10 | ||||
-rw-r--r-- | boost/intrusive/detail/iterator.hpp | 110 | ||||
-rw-r--r-- | boost/intrusive/detail/node_to_value.hpp | 2 | ||||
-rw-r--r-- | boost/intrusive/detail/pointer_element.hpp | 168 | ||||
-rw-r--r-- | boost/intrusive/detail/to_raw_pointer.hpp | 47 | ||||
-rw-r--r-- | boost/intrusive/detail/tree_value_compare.hpp | 12 |
9 files changed, 126 insertions, 231 deletions
diff --git a/boost/intrusive/detail/default_header_holder.hpp b/boost/intrusive/detail/default_header_holder.hpp index 288f8a0e41..ba561b5f5b 100644 --- a/boost/intrusive/detail/default_header_holder.hpp +++ b/boost/intrusive/detail/default_header_holder.hpp @@ -23,7 +23,7 @@ #include <boost/intrusive/detail/workaround.hpp> #include <boost/intrusive/pointer_traits.hpp> -#include <boost/intrusive/detail/to_raw_pointer.hpp> +#include <boost/move/detail/to_raw_pointer.hpp> namespace boost { namespace intrusive { @@ -48,7 +48,7 @@ struct default_header_holder : public NodeTraits::node // (unsafe) downcast used to implement container-from-iterator BOOST_INTRUSIVE_FORCEINLINE static default_header_holder* get_holder(const node_ptr &p) - { return static_cast< default_header_holder* >(boost::intrusive::detail::to_raw_pointer(p)); } + { return static_cast< default_header_holder* >(boost::movelib::to_raw_pointer(p)); } }; // type function producing the header node holder diff --git a/boost/intrusive/detail/ebo_functor_holder.hpp b/boost/intrusive/detail/ebo_functor_holder.hpp index 31b2f81398..27415c1170 100644 --- a/boost/intrusive/detail/ebo_functor_holder.hpp +++ b/boost/intrusive/detail/ebo_functor_holder.hpp @@ -35,7 +35,7 @@ namespace detail { #define BOOST_INTRUSIVE_TT_DECL #endif -#if defined(_MSC_EXTENSIONS) && !defined(__BORLAND__) && !defined(_WIN64) && !defined(_M_ARM) && !defined(UNDER_CE) +#if defined(_MSC_EXTENSIONS) && !defined(__BORLAND__) && !defined(_WIN64) && !defined(_M_ARM) && !defined(_M_ARM64) && !defined(UNDER_CE) #define BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS #endif diff --git a/boost/intrusive/detail/hashtable_node.hpp b/boost/intrusive/detail/hashtable_node.hpp index 8f8718e9a7..d3b11d1b22 100644 --- a/boost/intrusive/detail/hashtable_node.hpp +++ b/boost/intrusive/detail/hashtable_node.hpp @@ -246,7 +246,7 @@ class hashtable_iterator void increment() { const bucket_traits &rbuck_traits = this->priv_bucket_traits(); - bucket_type* const buckets = boost::intrusive::detail::to_raw_pointer(rbuck_traits.bucket_begin()); + bucket_type* const buckets = boost::movelib::to_raw_pointer(rbuck_traits.bucket_begin()); const size_type buckets_len = rbuck_traits.bucket_count(); ++slist_it_; diff --git a/boost/intrusive/detail/hook_traits.hpp b/boost/intrusive/detail/hook_traits.hpp index 2a16061a54..7a6f206ca2 100644 --- a/boost/intrusive/detail/hook_traits.hpp +++ b/boost/intrusive/detail/hook_traits.hpp @@ -26,7 +26,7 @@ #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/move/detail/to_raw_pointer.hpp> #include <boost/intrusive/detail/node_holder.hpp> namespace boost { @@ -128,14 +128,14 @@ struct mhtraits { return pointer_traits<pointer>::pointer_to (*detail::parent_from_member<T, Hook> - (static_cast<Hook*>(boost::intrusive::detail::to_raw_pointer(n)), P)); + (static_cast<Hook*>(boost::movelib::to_raw_pointer(n)), P)); } BOOST_INTRUSIVE_FORCEINLINE 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)); + (static_cast<const Hook*>(boost::movelib::to_raw_pointer(n)), P)); } }; @@ -161,10 +161,10 @@ struct fhtraits 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))); } + { return static_cast<node*>(boost::movelib::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))); } + { return static_cast<const node*>(boost::movelib::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)); } diff --git a/boost/intrusive/detail/iterator.hpp b/boost/intrusive/detail/iterator.hpp index 2ae6abb7d0..c25be430a2 100644 --- a/boost/intrusive/detail/iterator.hpp +++ b/boost/intrusive/detail/iterator.hpp @@ -27,6 +27,24 @@ #include <boost/move/detail/iterator_traits.hpp> #include <boost/move/detail/meta_utils_core.hpp> +namespace boost{ +namespace iterators{ + +struct incrementable_traversal_tag; +struct single_pass_traversal_tag; +struct forward_traversal_tag; +struct bidirectional_traversal_tag; +struct random_access_traversal_tag; + +namespace detail{ + +template <class Category, class Traversal> +struct iterator_category_with_traversal; + +} //namespace boost{ +} //namespace iterators{ +} //namespace detail{ + namespace boost { namespace intrusive { @@ -46,6 +64,28 @@ struct iterator }; //////////////////////////////////////// +// iterator_[dis|en]able_if_boost_iterator +//////////////////////////////////////// +template<class I> +struct is_boost_iterator +{ + static const bool value = false; +}; + +template<class Category, class Traversal> +struct is_boost_iterator< boost::iterators::detail::iterator_category_with_traversal<Category, Traversal> > +{ + static const bool value = true; +}; + +template<class I, class R = void> +struct iterator_enable_if_boost_iterator + : ::boost::move_detail::enable_if_c + < is_boost_iterator<typename boost::intrusive::iterator_traits<I>::iterator_category >::value + , R> +{}; + +//////////////////////////////////////// // iterator_[dis|en]able_if_tag //////////////////////////////////////// template<class I, class Tag, class R = void> @@ -69,6 +109,23 @@ struct iterator_disable_if_tag {}; //////////////////////////////////////// +// iterator_[dis|en]able_if_tag +//////////////////////////////////////// +template<class I, class Tag, class Tag2, class R = void> +struct iterator_enable_if_convertible_tag + : ::boost::move_detail::enable_if_c + < ::boost::move_detail::is_same_or_convertible + < typename boost::intrusive::iterator_traits<I>::iterator_category + , Tag + >::value && + !::boost::move_detail::is_same_or_convertible + < typename boost::intrusive::iterator_traits<I>::iterator_category + , Tag2 + >::value + , R> +{}; + +//////////////////////////////////////// // iterator_[dis|en]able_if_tag_difference_type //////////////////////////////////////// template<class I, class Tag> @@ -84,8 +141,9 @@ struct iterator_disable_if_tag_difference_type //////////////////// // advance //////////////////// + template<class InputIt, class Distance> -typename iterator_enable_if_tag<InputIt, std::input_iterator_tag>::type +BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_tag<InputIt, std::input_iterator_tag>::type iterator_advance(InputIt& it, Distance n) { while(n--) @@ -101,7 +159,7 @@ typename iterator_enable_if_tag<InputIt, std::forward_iterator_tag>::type } template<class InputIt, class Distance> -typename iterator_enable_if_tag<InputIt, std::bidirectional_iterator_tag>::type +BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_tag<InputIt, std::bidirectional_iterator_tag>::type iterator_advance(InputIt& it, Distance n) { for (; 0 < n; --n) @@ -117,6 +175,54 @@ BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_tag<InputIt, std::random it += n; } +template<class InputIt, class Distance> +BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_convertible_tag + <InputIt, const boost::iterators::incrementable_traversal_tag&, const boost::iterators::single_pass_traversal_tag&>::type + iterator_advance(InputIt& it, Distance n) +{ + while(n--) + ++it; +} + +template<class InputIt, class Distance> +BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_convertible_tag + <InputIt, const boost::iterators::single_pass_traversal_tag &, const boost::iterators::forward_traversal_tag&>::type + iterator_advance(InputIt& it, Distance n) +{ + while(n--) + ++it; +} + +template<class InputIt, class Distance> +BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_convertible_tag + <InputIt, const boost::iterators::forward_traversal_tag&, const boost::iterators::bidirectional_traversal_tag&>::type + iterator_advance(InputIt& it, Distance n) +{ + while(n--) + ++it; +} + +template<class InputIt, class Distance> +BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_convertible_tag + <InputIt, const boost::iterators::bidirectional_traversal_tag&, const boost::iterators::random_access_traversal_tag&>::type + iterator_advance(InputIt& it, Distance n) +{ + for (; 0 < n; --n) + ++it; + for (; n < 0; ++n) + --it; +} + +class fake{}; + +template<class InputIt, class Distance> +BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_convertible_tag + <InputIt, const boost::iterators::random_access_traversal_tag&, const fake&>::type + iterator_advance(InputIt& it, Distance n) +{ + it += n; +} + //////////////////// // distance //////////////////// diff --git a/boost/intrusive/detail/node_to_value.hpp b/boost/intrusive/detail/node_to_value.hpp index 5af3347345..218e78e4e0 100644 --- a/boost/intrusive/detail/node_to_value.hpp +++ b/boost/intrusive/detail/node_to_value.hpp @@ -59,7 +59,7 @@ struct constptr {} const void *get_ptr() const - { return boost::intrusive::detail::to_raw_pointer(const_void_ptr_); } + { return boost::movelib::to_raw_pointer(const_void_ptr_); } ConstVoidPtr const_void_ptr_; }; diff --git a/boost/intrusive/detail/pointer_element.hpp b/boost/intrusive/detail/pointer_element.hpp deleted file mode 100644 index dd26e3cf0b..0000000000 --- a/boost/intrusive/detail/pointer_element.hpp +++ /dev/null @@ -1,168 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (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 - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif - -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#ifndef BOOST_INTRUSIVE_DETAIL_WORKAROUND_HPP -#include <boost/intrusive/detail/workaround.hpp> -#endif //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; }; - -#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) diff --git a/boost/intrusive/detail/to_raw_pointer.hpp b/boost/intrusive/detail/to_raw_pointer.hpp deleted file mode 100644 index 8ea884959d..0000000000 --- a/boost/intrusive/detail/to_raw_pointer.hpp +++ /dev/null @@ -1,47 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// -// (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_TO_RAW_POINTER_HPP -#define BOOST_INTRUSIVE_DETAIL_TO_RAW_POINTER_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif - -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/intrusive/detail/config_begin.hpp> -#include <boost/intrusive/detail/workaround.hpp> -#include <boost/intrusive/detail/pointer_element.hpp> - -namespace boost { -namespace intrusive { -namespace detail { - -template <class T> -BOOST_INTRUSIVE_FORCEINLINE T* to_raw_pointer(T* p) -{ return p; } - -template <class Pointer> -BOOST_INTRUSIVE_FORCEINLINE typename boost::intrusive::pointer_element<Pointer>::type* -to_raw_pointer(const Pointer &p) -{ return boost::intrusive::detail::to_raw_pointer(p.operator->()); } - -} //namespace detail -} //namespace intrusive -} //namespace boost - -#include <boost/intrusive/detail/config_end.hpp> - -#endif //BOOST_INTRUSIVE_DETAIL_UTILITIES_HPP diff --git a/boost/intrusive/detail/tree_value_compare.hpp b/boost/intrusive/detail/tree_value_compare.hpp index c8f596fc96..f6dd01dc25 100644 --- a/boost/intrusive/detail/tree_value_compare.hpp +++ b/boost/intrusive/detail/tree_value_compare.hpp @@ -37,7 +37,8 @@ struct disable_if_smartref_to || detail::is_same <From, typename pointer_traits < typename pointer_rebind - <ValuePtr, const typename pointer_element<ValuePtr>::type>::type> + < ValuePtr + , const typename boost::movelib::pointer_element<ValuePtr>::type>::type> ::reference>::value > {}; @@ -45,11 +46,13 @@ struct disable_if_smartref_to //This function object takes a KeyCompare function object //and compares values that contains keys using KeyOfValue template< class ValuePtr, class KeyCompare, class KeyOfValue - , bool = boost::intrusive::detail::is_same<typename pointer_element<ValuePtr>::type, typename KeyOfValue::type>::value > + , bool = boost::intrusive::detail::is_same + <typename boost::movelib::pointer_element<ValuePtr>::type, typename KeyOfValue::type>::value > struct tree_value_compare : public boost::intrusive::detail::ebo_functor_holder<KeyCompare> { - typedef typename pointer_element<ValuePtr>::type value_type; + typedef typename + boost::movelib::pointer_element<ValuePtr>::type value_type; typedef KeyCompare key_compare; typedef KeyOfValue key_of_value; typedef typename KeyOfValue::type key_type; @@ -114,7 +117,8 @@ template<class ValuePtr, class KeyCompare, class KeyOfValue> struct tree_value_compare<ValuePtr, KeyCompare, KeyOfValue, true> : public boost::intrusive::detail::ebo_functor_holder<KeyCompare> { - typedef typename pointer_element<ValuePtr>::type value_type; + typedef typename + boost::movelib::pointer_element<ValuePtr>::type value_type; typedef KeyCompare key_compare; typedef KeyOfValue key_of_value; typedef typename KeyOfValue::type key_type; |