From 3c84ecf0e1b4361935527e52a3a53ba67fcca86c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Sat, 12 May 2007 12:54:15 +0000 Subject: [PATCH] Changes to correct regression tests for intel-win-9.1 & cw-9.4 [SVN r37676] --- .../intrusive/circular_list_algorithms.hpp | 4 +- .../intrusive/circular_slist_algorithms.hpp | 4 +- .../boost/intrusive/detail/config_begin.hpp | 11 +- include/boost/intrusive/detail/config_end.hpp | 11 +- .../boost/intrusive/detail/hashtable_node.hpp | 5 +- include/boost/intrusive/detail/list_node.hpp | 106 ++++++++++++++++- .../intrusive/detail/parent_from_member.hpp | 13 ++- .../intrusive/detail/pointer_to_other.hpp | 2 +- .../boost/intrusive/detail/pointer_type.hpp | 54 --------- .../boost/intrusive/detail/rbtree_node.hpp | 108 +++++++++++++++++- include/boost/intrusive/detail/slist_node.hpp | 98 +++++++++++++++- include/boost/intrusive/detail/utilities.hpp | 87 +++++++++----- include/boost/intrusive/hashtable.hpp | 21 ++-- include/boost/intrusive/intrusive_fwd.hpp | 2 +- include/boost/intrusive/linking_policy.hpp | 2 +- include/boost/intrusive/list.hpp | 8 +- include/boost/intrusive/list_hook.hpp | 16 +-- include/boost/intrusive/pointer_plus_bit.hpp | 2 +- include/boost/intrusive/rbtree.hpp | 16 +-- include/boost/intrusive/rbtree_algorithms.hpp | 8 +- include/boost/intrusive/set.hpp | 10 +- include/boost/intrusive/set_hook.hpp | 16 +-- include/boost/intrusive/slist.hpp | 6 +- include/boost/intrusive/slist_hook.hpp | 16 +-- include/boost/intrusive/tag.hpp | 2 +- include/boost/intrusive/unordered_set.hpp | 2 +- .../boost/intrusive/unordered_set_hook.hpp | 16 +-- 27 files changed, 433 insertions(+), 213 deletions(-) delete mode 100644 include/boost/intrusive/detail/pointer_type.hpp diff --git a/include/boost/intrusive/circular_list_algorithms.hpp b/include/boost/intrusive/circular_list_algorithms.hpp index 0351065..08f86b2 100644 --- a/include/boost/intrusive/circular_list_algorithms.hpp +++ b/include/boost/intrusive/circular_list_algorithms.hpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (C) Copyright Olaf Krzikalla 2004-2006. -// (C) Copyright Ion Gaztaņaga 2006-2007 +// (C) Copyright Ion Gaztanaga 2006-2007 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -18,9 +18,7 @@ #include #include #include -#include #include -#include #include namespace boost { diff --git a/include/boost/intrusive/circular_slist_algorithms.hpp b/include/boost/intrusive/circular_slist_algorithms.hpp index 7ae0d15..4a57a45 100644 --- a/include/boost/intrusive/circular_slist_algorithms.hpp +++ b/include/boost/intrusive/circular_slist_algorithms.hpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (C) Copyright Olaf Krzikalla 2004-2006. -// (C) Copyright Ion Gaztaņaga 2006-2007 +// (C) Copyright Ion Gaztanaga 2006-2007 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -18,9 +18,7 @@ #include #include #include -#include #include -#include #include namespace boost { diff --git a/include/boost/intrusive/detail/config_begin.hpp b/include/boost/intrusive/detail/config_begin.hpp index 1ef01d3..1f87d65 100644 --- a/include/boost/intrusive/detail/config_begin.hpp +++ b/include/boost/intrusive/detail/config_begin.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztaņaga 2006-2007 +// (C) Copyright Ion Gaztanaga 2006-2007 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -39,10 +39,5 @@ #pragma warning (disable : 4267) //conversion from 'X' to 'Y', possible loss of data #endif -#include -#include - -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) -# pragma warn -8026 // shut up warning "cannot inline function because ..." -# pragma warn -8027 // shut up warning "cannot inline function because ..." -#endif +//#define BOOST_INTRUSIVE_USE_ITERATOR_FACADE +//#define BOOST_INTRUSIVE_USE_ITERATOR_ENABLE_IF_CONVERTIBLE diff --git a/include/boost/intrusive/detail/config_end.hpp b/include/boost/intrusive/detail/config_end.hpp index 376ea57..703d038 100644 --- a/include/boost/intrusive/detail/config_end.hpp +++ b/include/boost/intrusive/detail/config_end.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztaņaga 2006-2007 +// (C) Copyright Ion Gaztanaga 2006-2007 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -9,14 +9,7 @@ // See http://www.boost.org/libs/intrusive for documentation. // ///////////////////////////////////////////////////////////////////////////// -#include -#include -#if defined _MSC_VER +#if defined BOOST_MSVC #pragma warning (pop) #endif - -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) -# pragma warn .8026 -# pragma warn .8027 -#endif diff --git a/include/boost/intrusive/detail/hashtable_node.hpp b/include/boost/intrusive/detail/hashtable_node.hpp index c807454..1f7e1a3 100644 --- a/include/boost/intrusive/detail/hashtable_node.hpp +++ b/include/boost/intrusive/detail/hashtable_node.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion GaztaīŋŊga 2007 +// (C) Copyright Ion Gaztanaga 2007 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -16,10 +16,8 @@ #include #include #include -#include #include #include -#include #include #include #include @@ -169,7 +167,6 @@ class hashtable_iterator void increment() { - using boost::get_pointer; size_type buckets_len = bucket_info_->buckets_len_; const_bucket_ptr buckets = bucket_info_->buckets_; const_local_iterator first = bucket_type::bucket_to_slist(buckets[0]).cend(); diff --git a/include/boost/intrusive/detail/list_node.hpp b/include/boost/intrusive/detail/list_node.hpp index 7ddd474..84f79b5 100644 --- a/include/boost/intrusive/detail/list_node.hpp +++ b/include/boost/intrusive/detail/list_node.hpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (C) Copyright Olaf Krzikalla 2004-2006. -// (C) Copyright Ion Gaztaņaga 2006-2007 +// (C) Copyright Ion Gaztanaga 2006-2007 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -17,13 +17,15 @@ #include #include #include -#include #include #include -#include +#ifdef BOOST_INTRUSIVE_USE_ITERATOR_FACADE #include +#endif +#ifdef BOOST_INTRUSIVE_USE_ITERATOR_ENABLE_IF_CONVERTIBLE #include #include +#endif #include namespace boost { @@ -60,6 +62,8 @@ struct list_node_traits { n->next_ = next; } }; +#ifdef BOOST_INTRUSIVE_USE_ITERATOR_FACADE + // list_iterator provides some basic functions for a // node oriented forward iterator: template @@ -123,6 +127,102 @@ class list_iterator node_ptr node_; }; +#else //BOOST_INTRUSIVE_USE_ITERATOR_FACADE + +// list_iterator provides some basic functions for a +// node oriented bidirectional iterator: +template +class list_iterator + : public std::iterator +{ + struct enabler{}; + protected: + typedef typename ValueTraits::node_traits node_traits; + typedef typename node_traits::node node; + typedef typename node_traits::node_ptr node_ptr; + + public: + typedef T & reference; + typedef T * pointer; + + list_iterator() + : node_ (0) + {} + + explicit list_iterator(node_ptr node) + : node_ (node) + {} + #ifdef BOOST_INTRUSIVE_USE_ITERATOR_ENABLE_IF_CONVERTIBLE + template + list_iterator(list_iterator const& other + ,typename boost::enable_if< + boost::is_convertible + , enabler + >::type = enabler() + ) + : node_(other.pointed_node()) + {} + #else + template + list_iterator(list_iterator const& other, + typename enable_if< + is_convertible + >::type* = 0) + : node_(other.pointed_node()) + {} + #endif + + const node_ptr &pointed_node() const + { return node_; } + + list_iterator &operator=(const node_ptr &node) + { node_ = node; return static_cast(*this); } + + public: + list_iterator& operator++() + { + node_ = node_traits::get_next(node_); + return static_cast (*this); + } + + list_iterator operator++(int) + { + list_iterator result (node_); + node_ = node_traits::get_next(node_); + return result; + } + + list_iterator& operator--() + { + node_ = node_traits::get_previous(node_); + return static_cast (*this); + } + + list_iterator operator--(int) + { + list_iterator result (node_); + node_ = node_traits::get_previous(node_); + return result; + } + + bool operator== (const list_iterator& i) const + { return node_ == i.pointed_node(); } + + bool operator!= (const list_iterator& i) const + { return !operator== (i); } + + T& operator*() const + { return *ValueTraits::to_value_ptr(node_); } + + pointer operator->() const + { return detail::get_pointer(ValueTraits::to_value_ptr(node_)); } + + private: + node_ptr node_; +}; + +#endif + } //namespace detail } //namespace intrusive } //namespace boost diff --git a/include/boost/intrusive/detail/parent_from_member.hpp b/include/boost/intrusive/detail/parent_from_member.hpp index 93af87a..2a7389f 100644 --- a/include/boost/intrusive/detail/parent_from_member.hpp +++ b/include/boost/intrusive/detail/parent_from_member.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztaņaga 2007 +// (C) Copyright Ion Gaztanaga 2007 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -12,6 +12,8 @@ #ifndef BOOST_INTRUSIVE_PARENT_FROM_MEMBER_HPP #define BOOST_INTRUSIVE_PARENT_FROM_MEMBER_HPP +#include + namespace boost { namespace intrusive { namespace detail { @@ -20,9 +22,12 @@ template std::size_t offset_from_pointer_to_member(const Member Parent::* ptr_to_member) { //This works with gcc and msvc + //The implementation of a pointer to member is compiler dependent. + #if defined(BOOST_MSVC) || defined(__GNUC__) || defined(BOOST_INTEL) return *(const std::size_t*)(const void*)&ptr_to_member; - //Other compilers might need other transformation, depending how a - //pointer to data member is implemented. + #else //CW 9.4 + return *(const std::size_t*)(const void*)&ptr_to_member - 1; + #endif } template @@ -43,4 +48,6 @@ const Parent *parent_from_member(const Member *member, const Member Parent::* pt } //namespace intrusive { } //namespace boost { +#include + #endif //#ifndef BOOST_INTRUSIVE_PARENT_FROM_MEMBER_HPP diff --git a/include/boost/intrusive/detail/pointer_to_other.hpp b/include/boost/intrusive/detail/pointer_to_other.hpp index 3d02450..36a192e 100644 --- a/include/boost/intrusive/detail/pointer_to_other.hpp +++ b/include/boost/intrusive/detail/pointer_to_other.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztaņaga 2006. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2006. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/include/boost/intrusive/detail/pointer_type.hpp b/include/boost/intrusive/detail/pointer_type.hpp deleted file mode 100644 index 80f73c6..0000000 --- a/include/boost/intrusive/detail/pointer_type.hpp +++ /dev/null @@ -1,54 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztaņaga 2006. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/intrusive for documentation. -// -///////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_INTRUSIVE_POINTER_TYPE_HPP -#define BOOST_INTRUSIVE_POINTER_TYPE_HPP - -#include - -namespace boost { -namespace intrusive { -namespace detail { - -struct two {char _[2];}; - -namespace pointer_type_imp -{ - -template static two test(...); -template static char test(typename U::pointer* = 0); - -} //namespace pointer_type_imp - -template -struct has_pointer_type -{ - static const bool value = sizeof(pointer_type_imp::test(0)) == 1; -}; - -template ::value> -struct pointer_type -{ - typedef typename A::pointer type; -}; - -template -struct pointer_type -{ - typedef T* type; -}; - -} //namespace detail -} //namespace intrusive -} // namespace boost - -#include - -#endif //#ifndef BOOST_INTRUSIVE_POINTER_TYPE_HPP diff --git a/include/boost/intrusive/detail/rbtree_node.hpp b/include/boost/intrusive/detail/rbtree_node.hpp index c25fad9..91baf5c 100644 --- a/include/boost/intrusive/detail/rbtree_node.hpp +++ b/include/boost/intrusive/detail/rbtree_node.hpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (C) Copyright Olaf Krzikalla 2004-2006. -// (C) Copyright Ion Gaztaņaga 2006-2007. +// (C) Copyright Ion Gaztanaga 2006-2007. // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -17,16 +17,18 @@ #include #include #include -#include #include #include -#include #include #include #include +#ifdef BOOST_INTRUSIVE_USE_ITERATOR_FACADE #include +#endif +#ifdef BOOST_INTRUSIVE_USE_ITERATOR_ENABLE_IF_CONVERTIBLE #include #include +#endif #include namespace boost { @@ -186,6 +188,8 @@ struct rbtree_node_traits // // ///////////////////////////////////////////////////////////////////////////// +#ifdef BOOST_INTRUSIVE_USE_ITERATOR_FACADE + template class rbtree_iterator : public boost::iterator_facade @@ -248,6 +252,104 @@ class rbtree_iterator node_ptr node_; }; +#else + +// rbtree_iterator provides some basic functions for a +// node oriented bidirectional iterator: +template +class rbtree_iterator + : public std::iterator +{ + struct enabler{}; + protected: + typedef typename ValueTraits::node_traits node_traits; + typedef typename node_traits::node node; + typedef typename node_traits::node_ptr node_ptr; + typedef rbtree_algorithms node_algorithms; + + public: + typedef T & reference; + typedef T * pointer; + + rbtree_iterator() + : node_ (0) + {} + + explicit rbtree_iterator(node_ptr node) + : node_ (node) + {} + + #ifdef BOOST_INTRUSIVE_USE_ITERATOR_ENABLE_IF_CONVERTIBLE + template + rbtree_iterator(rbtree_iterator const& other + ,typename boost::enable_if< + boost::is_convertible + , enabler + >::type = enabler() + ) + : node_(other.pointed_node()) + {} + #else + template + rbtree_iterator(rbtree_iterator const& other, + typename enable_if< + is_convertible + >::type* = 0) + : node_(other.pointed_node()) + {} + #endif + + const node_ptr &pointed_node() const + { return node_; } + + rbtree_iterator &operator=(const node_ptr &node) + { node_ = node; return static_cast(*this); } + + public: + rbtree_iterator& operator++() + { + node_ = node_algorithms::next_node(node_); + return static_cast (*this); + } + + rbtree_iterator operator++(int) + { + rbtree_iterator result (node_); + node_ = node_algorithms::next_node(node_); + return result; + } + + rbtree_iterator& operator--() + { + node_ = node_algorithms::prev_node(node_); + return static_cast (*this); + } + + rbtree_iterator operator--(int) + { + rbtree_iterator result (node_); + node_ = node_algorithms::prev_node(node_); + return result; + } + + bool operator== (const rbtree_iterator& i) const + { return node_ == i.pointed_node(); } + + bool operator!= (const rbtree_iterator& i) const + { return !operator== (i); } + + T& operator*() const + { return *ValueTraits::to_value_ptr(node_); } + + pointer operator->() const + { return detail::get_pointer(ValueTraits::to_value_ptr(node_)); } + + private: + node_ptr node_; +}; + +#endif + } //namespace detail } //namespace intrusive } //namespace boost diff --git a/include/boost/intrusive/detail/slist_node.hpp b/include/boost/intrusive/detail/slist_node.hpp index f8b2089..f9d3b25 100644 --- a/include/boost/intrusive/detail/slist_node.hpp +++ b/include/boost/intrusive/detail/slist_node.hpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (C) Copyright Olaf Krzikalla 2004-2006. -// (C) Copyright Ion Gaztaņaga 2006-2007 +// (C) Copyright Ion Gaztanaga 2006-2007 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -17,13 +17,15 @@ #include #include #include -#include #include #include -#include +#ifdef BOOST_INTRUSIVE_USE_ITERATOR_FACADE #include +#endif +#ifdef BOOST_INTRUSIVE_USE_ITERATOR_ENABLE_IF_CONVERTIBLE #include #include +#endif #include namespace boost { @@ -55,6 +57,7 @@ struct slist_node_traits { n->next_ = next; } }; +#ifdef BOOST_INTRUSIVE_USE_ITERATOR_FACADE // slist_iterator provides some basic functions for a // node oriented forward iterator: @@ -86,6 +89,7 @@ class slist_iterator : node_ (node) {} + #ifdef BOOST_INTRUSIVE_USE_ITERATOR_ENABLE_IF_CONVERTIBLE template slist_iterator(slist_iterator const& other ,typename boost::enable_if< @@ -95,6 +99,15 @@ class slist_iterator ) : node_(other.pointed_node()) {} + #else + template + slist_iterator(slist_iterator const& other, + typename enable_if< + is_convertible + >::type* = 0) + : node_(other.pointed_node()) + {} + #endif const node_ptr &pointed_node() const { return node_; } @@ -116,6 +129,85 @@ class slist_iterator node_ptr node_; }; +#else + +// slist_iterator provides some basic functions for a +// node oriented bidirectional iterator: +template +class slist_iterator + : public std::iterator +{ + struct enabler{}; + protected: + typedef typename ValueTraits::node_traits node_traits; + typedef typename node_traits::node node; + typedef typename node_traits::node_ptr node_ptr; + + public: + typedef T & reference; + typedef T * pointer; + + slist_iterator() + : node_ (0) + {} + + explicit slist_iterator(node_ptr node) + : node_ (node) + {} +/* + template + slist_iterator(slist_iterator const& other + ,typename boost::enable_if< + boost::is_convertible + , enabler + >::type = enabler() + ) + : node_(other.pointed_node()) + {} +*/ + template + slist_iterator(slist_iterator const& other) + : node_(other.pointed_node()) + {} + + const node_ptr &pointed_node() const + { return node_; } + + slist_iterator &operator=(const node_ptr &node) + { node_ = node; return static_cast(*this); } + + public: + slist_iterator& operator++() + { + node_ = node_traits::get_next(node_); + return static_cast (*this); + } + + slist_iterator operator++(int) + { + slist_iterator result (node_); + node_ = node_traits::get_next(node_); + return result; + } + + bool operator== (const slist_iterator& i) const + { return node_ == i.pointed_node(); } + + bool operator!= (const slist_iterator& i) const + { return !operator== (i); } + + T& operator*() const + { return *ValueTraits::to_value_ptr(node_); } + + pointer operator->() const + { return detail::get_pointer(ValueTraits::to_value_ptr(node_)); } + + private: + node_ptr node_; +}; + +#endif + } //namespace detail } //namespace intrusive } //namespace boost diff --git a/include/boost/intrusive/detail/utilities.hpp b/include/boost/intrusive/detail/utilities.hpp index 8fab221..a74c8ba 100644 --- a/include/boost/intrusive/detail/utilities.hpp +++ b/include/boost/intrusive/detail/utilities.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztaņaga 2006-2007 +// (C) Copyright Ion Gaztanaga 2006-2007 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -14,18 +14,41 @@ #define BOOST_INTRUSIVE_DETAIL_UTILITIES_HPP #include -#include #include #include #include #include -#include #include namespace boost { namespace intrusive { namespace detail { +template +struct smart_ptr_type +{ + typedef typename SmartPtr::value_type value_type; + typedef value_type *pointer; + static pointer get (const SmartPtr &smartptr) + { return smartptr.get();} +}; + +template +struct smart_ptr_type +{ + typedef T value_type; + typedef value_type *pointer; + static pointer get (pointer ptr) + { return ptr;} +}; + +//!Overload for smart pointers to avoid ADL problems with get_pointer +template +inline typename smart_ptr_type::pointer +get_pointer(const Ptr &ptr) +{ return smart_ptr_type::get(ptr); } +//{ using boost::get_pointer; return get_pointer(ptr); } + //This functor compares a stored value //and the one passed as an argument template @@ -112,14 +135,12 @@ struct derivation_value_traits static pointer to_value_ptr(node_ptr n) { - using boost::get_pointer; - return static_cast(get_pointer(DerivationHookType::to_hook_ptr(n))); + return static_cast(detail::get_pointer(DerivationHookType::to_hook_ptr(n))); } static const_pointer to_value_ptr(const_node_ptr n) { - using boost::get_pointer; - return static_cast(get_pointer(DerivationHookType::to_hook_ptr(n))); + return static_cast(detail::get_pointer(DerivationHookType::to_hook_ptr(n))); } }; @@ -158,27 +179,14 @@ struct member_value_traits //the needed bytes. static pointer to_value_ptr(node_ptr n) { - using boost::get_pointer; - return pointer(parent_from_member((MemberHookType*)get_pointer(n), P)); + return pointer(parent_from_member + ((MemberHookType*)detail::get_pointer(n), P)); } static const_pointer to_value_ptr(const_node_ptr n) { - using boost::get_pointer; - const_pointer(parent_from_member((const MemberHookType*)get_pointer(n), P)); - } - - private: - //This function converts a pointer to data member into an offset. - //This function is not standard and it's compiler-dependent. - static std::size_t value_to_node_offset() - { - const MemberHookType T::* const p = P; - return *(const std::size_t*)(const void *)(&p); -// using boost::get_pointer; -// const typename node_traits::node *np = -// get_pointer((((const value_type *)get_pointer(n))->*P).to_node_ptr()); -// return ((const char*)np - (const char*)(const value_type *)get_pointer(n)); + const_pointer(parent_from_member + ((const MemberHookType*)detail::get_pointer(n), P)); } }; @@ -207,7 +215,6 @@ struct key_node_ptr_compare } }; - template struct value_to_node_cloner : private detail::ebo_holder @@ -243,14 +250,14 @@ struct dispatcher template void destructor_impl(Container &cont, dispatcher) -{ BOOST_ASSERT(!cont.is_linked()); } +{ (void)cont; BOOST_ASSERT(!cont.is_linked()); } template void destructor_impl(Container &cont, dispatcher) { cont.unlink(); } template -void destructor_impl(Container &cont, dispatcher) +void destructor_impl(Container &, dispatcher) {} template @@ -283,6 +290,32 @@ struct node_plus_pred { return static_cast(n); } }; +#ifndef BOOST_INTRUSIVE_USE_ITERATOR_ENABLE_IF_CONVERTIBLE + +template +struct enable_if_c { + typedef T type; +}; + +template +struct enable_if_c {}; + +template +struct enable_if : public enable_if_c {}; + +template +class is_convertible +{ + typedef char true_t; + class false_t { char dummy[2]; }; + static true_t dispatch(U); + static false_t dispatch(...); + static T trigger(); + public: + enum { value = sizeof(dispatch(trigger())) == sizeof(true_t) }; +}; + +#endif //#ifndef BOOST_INTRUSIVE_USE_ITERATOR_ENABLE_IF_CONVERTIBLE } //namespace detail } //namespace intrusive diff --git a/include/boost/intrusive/hashtable.hpp b/include/boost/intrusive/hashtable.hpp index 412c961..2835b6b 100644 --- a/include/boost/intrusive/hashtable.hpp +++ b/include/boost/intrusive/hashtable.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztaņaga 2006-2007 +// (C) Copyright Ion Gaztanaga 2006-2007 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -26,7 +26,6 @@ #include //General intrusive utilities #include -#include #include #include #include @@ -143,14 +142,12 @@ class hashtable static node_ptr uncast(const_node_ptr ptr) { - using boost::get_pointer; - return node_ptr(const_cast(get_pointer(ptr))); + return node_ptr(const_cast(detail::get_pointer(ptr))); } static bucket_info_ptr uncast(const_bucket_info_ptr ptr) { - using boost::get_pointer; - return bucket_info_ptr(const_cast(get_pointer(ptr))); + return bucket_info_ptr(const_cast(detail::get_pointer(ptr))); } static slist_impl &bucket_to_slist(bucket_type &b) @@ -204,8 +201,7 @@ class hashtable iterator end() { - using boost::get_pointer; - bucket_info_t *info = get_pointer(this->priv_bucket_info()); + bucket_info_t *info = detail::get_pointer(this->priv_bucket_info()); return iterator(invalid_local_it(*info), 0); } @@ -214,8 +210,7 @@ class hashtable const_iterator cend() const { - using boost::get_pointer; - const bucket_info_t *info = get_pointer(this->priv_bucket_info()); + const bucket_info_t *info = detail::get_pointer(this->priv_bucket_info()); return const_iterator(invalid_local_it(*info), 0); } @@ -231,9 +226,8 @@ class hashtable return !size(); } else{ - using boost::get_pointer; size_type buckets_len = this->priv_buckets_len(); - const bucket_type *b = get_pointer(this->priv_buckets()); + const bucket_type *b = detail::get_pointer(this->priv_buckets()); for (size_type n = 0; n < buckets_len; ++n, ++b){ if(!b->empty()){ return false; @@ -249,9 +243,8 @@ class hashtable return size_traits::get_size(); else{ size_type len = 0; - using boost::get_pointer; size_type buckets_len = this->priv_buckets_len(); - const bucket_type *b = get_pointer(this->priv_buckets()); + const bucket_type *b = detail::get_pointer(this->priv_buckets()); for (size_type n = 0; n < buckets_len; ++n, ++b){ len += b->size(); } diff --git a/include/boost/intrusive/intrusive_fwd.hpp b/include/boost/intrusive/intrusive_fwd.hpp index c7cc71a..8f7c103 100644 --- a/include/boost/intrusive/intrusive_fwd.hpp +++ b/include/boost/intrusive/intrusive_fwd.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztaņaga 2007 +// (C) Copyright Ion Gaztanaga 2007 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/include/boost/intrusive/linking_policy.hpp b/include/boost/intrusive/linking_policy.hpp index 75d46fa..a50124b 100644 --- a/include/boost/intrusive/linking_policy.hpp +++ b/include/boost/intrusive/linking_policy.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztaņaga 2006-2007 +// (C) Copyright Ion Gaztanaga 2006-2007 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/include/boost/intrusive/list.hpp b/include/boost/intrusive/list.hpp index d46c793..df2089d 100644 --- a/include/boost/intrusive/list.hpp +++ b/include/boost/intrusive/list.hpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (C) Copyright Olaf Krzikalla 2004-2006. -// (C) Copyright Ion Gaztaņaga 2006-2007 +// (C) Copyright Ion Gaztanaga 2006-2007 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -20,10 +20,8 @@ #include #include #include -#include #include #include -#include #include #include #include @@ -97,8 +95,8 @@ class list //Const cast emulation for smart pointers static node_ptr uncast(const_node_ptr ptr) { - using boost::get_pointer; - return node_ptr(const_cast(get_pointer(ptr))); + //return node_ptr(detail::get_pointer(ptr))); + return const_cast(detail::get_pointer(ptr)); } node_ptr get_root_node() diff --git a/include/boost/intrusive/list_hook.hpp b/include/boost/intrusive/list_hook.hpp index 4a23fc0..19ac691 100644 --- a/include/boost/intrusive/list_hook.hpp +++ b/include/boost/intrusive/list_hook.hpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (C) Copyright Olaf Krzikalla 2004-2006. -// (C) Copyright Ion Gaztaņaga 2006-2007 +// (C) Copyright Ion Gaztanaga 2006-2007 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -17,13 +17,11 @@ #include #include #include -#include #include #include #include #include #include -#include #include #include @@ -186,8 +184,7 @@ class list_base_hook //! Throws: Nothing. static this_type_ptr to_hook_ptr(node_ptr p) { - using boost::get_pointer; - return this_type_ptr(static_cast (get_pointer(p))); + return this_type_ptr(static_cast (detail::get_pointer(p))); } //! Effects: Converts a const pointer to a node stored in a container into @@ -196,8 +193,7 @@ class list_base_hook //! Throws: Nothing. static const_this_type_ptr to_hook_ptr(const_node_ptr p) { - using boost::get_pointer; - return const_this_type_ptr(static_cast (get_pointer(p))); + return const_this_type_ptr(static_cast (detail::get_pointer(p))); } //! Effects: Returns a pointer to the node that this hook holds. @@ -365,8 +361,7 @@ class list_member_hook //! Throws: Nothing. static this_type_ptr to_hook_ptr(node_ptr p) { - using boost::get_pointer; - return this_type_ptr(static_cast (get_pointer(p))); + return this_type_ptr(static_cast (detail::get_pointer(p))); } //! Effects: Converts a const pointer to a node stored in a container into @@ -375,8 +370,7 @@ class list_member_hook //! Throws: Nothing. static const_this_type_ptr to_hook_ptr(const_node_ptr p) { - using boost::get_pointer; - return const_this_type_ptr(static_cast (get_pointer(p))); + return const_this_type_ptr(static_cast (detail::get_pointer(p))); } //! Effects: Returns a pointer to the node that this hook holds. diff --git a/include/boost/intrusive/pointer_plus_bit.hpp b/include/boost/intrusive/pointer_plus_bit.hpp index 7551869..8a2de51 100644 --- a/include/boost/intrusive/pointer_plus_bit.hpp +++ b/include/boost/intrusive/pointer_plus_bit.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztaņaga 2007 +// (C) Copyright Ion Gaztanaga 2007 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/include/boost/intrusive/rbtree.hpp b/include/boost/intrusive/rbtree.hpp index 264cbd7..4aac287 100644 --- a/include/boost/intrusive/rbtree.hpp +++ b/include/boost/intrusive/rbtree.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztaņaga 2006-2007 +// (C) Copyright Ion Gaztanaga 2006-2007 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include @@ -107,8 +106,7 @@ class rbtree static node_ptr uncast(const_node_ptr ptr) { - using boost::get_pointer; - return node_ptr(const_cast(get_pointer(ptr))); + return node_ptr(const_cast(detail::get_pointer(ptr))); } /// @endcond @@ -271,9 +269,8 @@ class rbtree //! Complexity: Constant. static rbtree &container_from_end_iterator(iterator end_iterator) { - using boost::get_pointer; - return *detail::parent_from_member - ( members_t::this_from_node(get_pointer(end_iterator.pointed_node())) + return *detail::parent_from_member + ( members_t::this_from_node(detail::get_pointer(end_iterator.pointed_node())) , &rbtree::members_); } @@ -287,9 +284,8 @@ class rbtree //! Complexity: Constant. static const rbtree &container_from_end_iterator(const_iterator end_iterator) { - using boost::get_pointer; - return *detail::parent_from_member - ( members_t::this_from_node(get_pointer(end_iterator.pointed_node())) + return *detail::parent_from_member + ( members_t::this_from_node(detail::get_pointer(end_iterator.pointed_node())) , &rbtree::members_); } diff --git a/include/boost/intrusive/rbtree_algorithms.hpp b/include/boost/intrusive/rbtree_algorithms.hpp index fbd7d77..3b40e2d 100644 --- a/include/boost/intrusive/rbtree_algorithms.hpp +++ b/include/boost/intrusive/rbtree_algorithms.hpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (C) Copyright Olaf Krzikalla 2004-2006. -// (C) Copyright Ion Gaztaņaga 2006-2007. +// (C) Copyright Ion Gaztanaga 2006-2007. // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -43,12 +43,11 @@ #include #include #include -#include #include -#include #include #include #include +#include namespace boost { @@ -916,8 +915,7 @@ class rbtree_algorithms private: static node_ptr uncast(const_node_ptr ptr) { - using boost::get_pointer; - return node_ptr(const_cast(get_pointer(ptr))); + return node_ptr(const_cast(detail::get_pointer(ptr))); } //! Requires: z is the node to be inserted, par is its parent, diff --git a/include/boost/intrusive/set.hpp b/include/boost/intrusive/set.hpp index ab81763..2a189b6 100644 --- a/include/boost/intrusive/set.hpp +++ b/include/boost/intrusive/set.hpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (C) Copyright Olaf Krzikalla 2004-2006. -// (C) Copyright Ion Gaztaņaga 2006-2007 +// (C) Copyright Ion Gaztanaga 2006-2007 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -234,7 +234,7 @@ class set //! Complexity: Constant. static set &container_from_end_iterator(iterator end_iterator) { - return *detail::parent_from_member + return *detail::parent_from_member ( &tree_type::container_from_end_iterator(end_iterator) , &set::tree_); } @@ -249,7 +249,7 @@ class set //! Complexity: Constant. static const set &container_from_end_iterator(const_iterator end_iterator) { - return *detail::parent_from_member + return *detail::parent_from_member ( &tree_type::container_from_end_iterator(end_iterator) , &set::tree_); } @@ -1126,7 +1126,7 @@ class multiset //! Complexity: Constant. static multiset &container_from_end_iterator(iterator end_iterator) { - return *detail::parent_from_member + return *detail::parent_from_member ( &tree_type::container_from_end_iterator(end_iterator) , &multiset::tree_); } @@ -1141,7 +1141,7 @@ class multiset //! Complexity: Constant. static const multiset &container_from_end_iterator(const_iterator end_iterator) { - return *detail::parent_from_member + return *detail::parent_from_member ( &tree_type::container_from_end_iterator(end_iterator) , &multiset::tree_); } diff --git a/include/boost/intrusive/set_hook.hpp b/include/boost/intrusive/set_hook.hpp index 0986365..f7842c1 100644 --- a/include/boost/intrusive/set_hook.hpp +++ b/include/boost/intrusive/set_hook.hpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (C) Copyright Olaf Krzikalla 2004-2006. -// (C) Copyright Ion Gaztaņaga 2006-2007 +// (C) Copyright Ion Gaztanaga 2006-2007 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -17,13 +17,11 @@ #include #include #include -#include #include #include #include #include #include -#include #include #include @@ -174,8 +172,7 @@ class set_base_hook //! Throws: Nothing. static this_type_ptr to_hook_ptr(node_ptr p) { - using boost::get_pointer; - return this_type_ptr(static_cast (get_pointer(p))); + return this_type_ptr(static_cast (detail::get_pointer(p))); } //! Effects: Converts a const pointer to a node stored in a container into @@ -184,8 +181,7 @@ class set_base_hook //! Throws: Nothing. static const_this_type_ptr to_hook_ptr(const_node_ptr p) { - using boost::get_pointer; - return const_this_type_ptr(static_cast (get_pointer(p))); + return const_this_type_ptr(static_cast (detail::get_pointer(p))); } //! Effects: Returns a pointer to the node that this hook holds. @@ -332,8 +328,7 @@ class set_member_hook //! Throws: Nothing. static this_type_ptr to_hook_ptr(node_ptr p) { - using boost::get_pointer; - return this_type_ptr(static_cast (get_pointer(p))); + return this_type_ptr(static_cast (detail::get_pointer(p))); } //! Effects: Converts a const pointer to a node stored in a container into @@ -342,8 +337,7 @@ class set_member_hook //! Throws: Nothing. static const_this_type_ptr to_hook_ptr(const_node_ptr p) { - using boost::get_pointer; - return const_this_type_ptr(static_cast (get_pointer(p))); + return const_this_type_ptr(static_cast (detail::get_pointer(p))); } //! Effects: Returns a pointer to the node that this hook holds. diff --git a/include/boost/intrusive/slist.hpp b/include/boost/intrusive/slist.hpp index 627a4b5..9a605c7 100644 --- a/include/boost/intrusive/slist.hpp +++ b/include/boost/intrusive/slist.hpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (C) Copyright Olaf Krzikalla 2004-2006. -// (C) Copyright Ion Gaztaņaga 2006-2007 +// (C) Copyright Ion Gaztanaga 2006-2007 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -112,8 +111,7 @@ class slist static node_ptr uncast(const_node_ptr ptr) { - using boost::get_pointer; - return node_ptr(const_cast(get_pointer(ptr))); + return node_ptr(const_cast(detail::get_pointer(ptr))); } static iterator previous_node(iterator beg, iterator i) diff --git a/include/boost/intrusive/slist_hook.hpp b/include/boost/intrusive/slist_hook.hpp index b6ce0f1..6a54e9f 100644 --- a/include/boost/intrusive/slist_hook.hpp +++ b/include/boost/intrusive/slist_hook.hpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (C) Copyright Olaf Krzikalla 2004-2006. -// (C) Copyright Ion Gaztaņaga 2006-2007 +// (C) Copyright Ion Gaztanaga 2006-2007 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -17,13 +17,11 @@ #include #include #include -#include #include #include #include #include #include -#include #include #include @@ -189,8 +187,7 @@ class slist_base_hook //! Throws: Nothing. static this_type_ptr to_hook_ptr(node_ptr p) { - using boost::get_pointer; - return this_type_ptr(static_cast (get_pointer(p))); + return this_type_ptr(static_cast (detail::get_pointer(p))); } //! Effects: Converts a const pointer to a node stored in a container into @@ -199,8 +196,7 @@ class slist_base_hook //! Throws: Nothing. static const_this_type_ptr to_hook_ptr(const_node_ptr p) { - using boost::get_pointer; - return const_this_type_ptr(static_cast (get_pointer(p))); + return const_this_type_ptr(static_cast (detail::get_pointer(p))); } //! Effects: Returns a pointer to the node that this hook holds. @@ -372,8 +368,7 @@ class slist_member_hook //! Throws: Nothing. static this_type_ptr to_hook_ptr(node_ptr p) { - using boost::get_pointer; - return this_type_ptr(static_cast (get_pointer(p))); + return this_type_ptr(static_cast (detail::get_pointer(p))); } //! Effects: Converts a const pointer to a node stored in a container into @@ -382,8 +377,7 @@ class slist_member_hook //! Throws: Nothing. static const_this_type_ptr to_hook_ptr(const_node_ptr p) { - using boost::get_pointer; - return const_this_type_ptr(static_cast (get_pointer(p))); + return const_this_type_ptr(static_cast (detail::get_pointer(p))); } //! Effects: Returns a pointer to the node that this hook holds. diff --git a/include/boost/intrusive/tag.hpp b/include/boost/intrusive/tag.hpp index c885289..649b3af 100644 --- a/include/boost/intrusive/tag.hpp +++ b/include/boost/intrusive/tag.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztaņaga 2006-2007 +// (C) Copyright Ion Gaztanaga 2006-2007 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/include/boost/intrusive/unordered_set.hpp b/include/boost/intrusive/unordered_set.hpp index 3f8368e..841f78e 100644 --- a/include/boost/intrusive/unordered_set.hpp +++ b/include/boost/intrusive/unordered_set.hpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (C) Copyright Olaf Krzikalla 2004-2006. -// (C) Copyright Ion Gaztaņaga 2006-2007 +// (C) Copyright Ion Gaztanaga 2006-2007 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/include/boost/intrusive/unordered_set_hook.hpp b/include/boost/intrusive/unordered_set_hook.hpp index 757b1bb..a0d3c3d 100644 --- a/include/boost/intrusive/unordered_set_hook.hpp +++ b/include/boost/intrusive/unordered_set_hook.hpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (C) Copyright Olaf Krzikalla 2004-2006. -// (C) Copyright Ion Gaztaņaga 2006-2007 +// (C) Copyright Ion Gaztanaga 2006-2007 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -17,11 +17,9 @@ #include #include #include -#include #include #include #include -#include #include namespace boost { @@ -133,8 +131,7 @@ class unordered_set_base_hook //! Throws: Nothing. static this_type_ptr to_hook_ptr(node_ptr p) { - using boost::get_pointer; - return this_type_ptr((this_type*)get_pointer(IsListHook::to_hook_ptr(p))); + return this_type_ptr((this_type*)detail::get_pointer(IsListHook::to_hook_ptr(p))); } //! Effects: Converts a const pointer to a node stored in a container into @@ -143,8 +140,7 @@ class unordered_set_base_hook //! Throws: Nothing. static const_this_type_ptr to_hook_ptr(const_node_ptr p) { - using boost::get_pointer; - return const_this_type_ptr((const this_type*)get_pointer(IsListHook::to_hook_ptr(p))); + return const_this_type_ptr((const this_type*)detail::get_pointer(IsListHook::to_hook_ptr(p))); } //! Effects: Returns a pointer to the node that this hook holds. @@ -262,8 +258,7 @@ class unordered_set_member_hook //! Throws: Nothing. static this_type_ptr to_hook_ptr(node_ptr p) { - using boost::get_pointer; - return this_type_ptr((this_type*)get_pointer(IsListHook::to_hook_ptr(p))); + return this_type_ptr((this_type*)detail::get_pointer(IsListHook::to_hook_ptr(p))); } //! Effects: Converts a const pointer to a node stored in a container into @@ -272,8 +267,7 @@ class unordered_set_member_hook //! Throws: Nothing. static const_this_type_ptr to_hook_ptr(const_node_ptr p) { - using boost::get_pointer; - return const_this_type_ptr((const this_type*)get_pointer(IsListHook::to_hook_ptr(p))); + return const_this_type_ptr((const this_type*)detail::get_pointer(IsListHook::to_hook_ptr(p))); } //! Effects: Returns a pointer to the node that this hook holds.