From aba4841424ad21a2bd1bc395cbc0de6f451df860 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Thu, 26 Aug 2010 21:35:57 +0000 Subject: [PATCH] Fixes for Boost 1.45 [SVN r65040] --- include/boost/intrusive/avltree.hpp | 6 ++-- .../boost/intrusive/member_value_traits.hpp | 4 +-- include/boost/intrusive/sgtree.hpp | 4 +-- include/boost/intrusive/slist.hpp | 36 ++++++++++++++----- 4 files changed, 34 insertions(+), 16 deletions(-) diff --git a/include/boost/intrusive/avltree.hpp b/include/boost/intrusive/avltree.hpp index e65f182..4b6e089 100644 --- a/include/boost/intrusive/avltree.hpp +++ b/include/boost/intrusive/avltree.hpp @@ -113,7 +113,7 @@ class avltree_impl ::type node_ptr; typedef typename boost::pointer_to_other ::type const_node_ptr; - typedef avltree_algorithms node_algorithms; + typedef avltree_algorithms node_algorithms; static const bool constant_time_size = Config::constant_time_size; static const bool stateful_value_traits = detail::store_cont_ptr_on_it::value; @@ -167,7 +167,7 @@ class avltree_impl static node_ptr uncast(const_node_ptr ptr) { - return node_ptr(const_cast(detail::get_pointer(ptr))); + return node_ptr(const_cast(detail::boost_intrusive_get_pointer(ptr))); } size_traits &priv_size_traits() @@ -1398,7 +1398,7 @@ class avltree_impl static avltree_impl &priv_container_from_end_iterator(const const_iterator &end_iterator) { header_plus_size *r = detail::parent_from_member - ( detail::get_pointer(end_iterator.pointed_node()), &header_plus_size::header_); + ( detail::boost_intrusive_get_pointer(end_iterator.pointed_node()), &header_plus_size::header_); node_plus_pred_t *n = detail::parent_from_member (r, &node_plus_pred_t::header_plus_size_); data_t *d = detail::parent_from_member(n, &data_t::node_plus_pred_); diff --git a/include/boost/intrusive/member_value_traits.hpp b/include/boost/intrusive/member_value_traits.hpp index ce7e56b..4490d49 100644 --- a/include/boost/intrusive/member_value_traits.hpp +++ b/include/boost/intrusive/member_value_traits.hpp @@ -49,13 +49,13 @@ struct member_value_traits static pointer to_value_ptr(node_ptr n) { return pointer(detail::parent_from_member - (detail::get_pointer(n), PtrToMember)); + (detail::boost_intrusive_get_pointer(n), PtrToMember)); } static const_pointer to_value_ptr(const_node_ptr n) { return pointer(detail::parent_from_member - (detail::get_pointer(n), PtrToMember)); + (detail::boost_intrusive_get_pointer(n), PtrToMember)); } }; diff --git a/include/boost/intrusive/sgtree.hpp b/include/boost/intrusive/sgtree.hpp index 5507893..5cc361a 100644 --- a/include/boost/intrusive/sgtree.hpp +++ b/include/boost/intrusive/sgtree.hpp @@ -310,7 +310,7 @@ class sgtree_impl { return data_.node_plus_pred_.header_plus_alpha_.header_; } static node_ptr uncast(const_node_ptr ptr) - { return node_ptr(const_cast(detail::get_pointer(ptr))); } + { return node_ptr(const_cast(detail::boost_intrusive_get_pointer(ptr))); } size_traits &priv_size_traits() { return data_.node_plus_pred_.size_traits_; } @@ -1631,7 +1631,7 @@ class sgtree_impl static sgtree_impl &priv_container_from_end_iterator(const const_iterator &end_iterator) { header_plus_alpha *r = detail::parent_from_member - ( detail::get_pointer(end_iterator.pointed_node()), &header_plus_alpha::header_); + ( detail::boost_intrusive_get_pointer(end_iterator.pointed_node()), &header_plus_alpha::header_); node_plus_pred_t *n = detail::parent_from_member (r, &node_plus_pred_t::header_plus_alpha_); data_t *d = detail::parent_from_member(n, &data_t::node_plus_pred_); diff --git a/include/boost/intrusive/slist.hpp b/include/boost/intrusive/slist.hpp index 8314a75..6aad69e 100644 --- a/include/boost/intrusive/slist.hpp +++ b/include/boost/intrusive/slist.hpp @@ -31,6 +31,7 @@ #include #include //std::size_t #include //std::pair +//iG pending #include namespace boost { namespace intrusive { @@ -129,10 +130,9 @@ class slist_impl typedef slist_iterator const_iterator; typedef typename real_value_traits::node_traits node_traits; typedef typename node_traits::node node; - typedef typename boost::pointer_to_other - ::type node_ptr; - typedef typename boost::pointer_to_other - ::type const_node_ptr; + typedef typename node_traits::node_ptr node_ptr; + typedef typename node_traits::const_node_ptr const_node_ptr; + typedef typename detail::if_c < Config::linear , linear_slist_algorithms @@ -206,7 +206,8 @@ class slist_impl { data_.root_plus_size_.last_ = n; } static node_ptr uncast(const_node_ptr ptr) - { return node_ptr(const_cast(detail::get_pointer(ptr))); } + { return node_ptr(const_cast(detail::boost_intrusive_get_pointer(ptr))); } +//iG pending { return boost::const_pointer_cast(ptr); } void set_default_constructed_state() { @@ -251,6 +252,22 @@ class slist_impl real_value_traits &get_real_value_traits(detail::bool_) { return data_.get_value_traits(*this); } + const value_traits &get_value_traits() const + { return data_; } + + value_traits &get_value_traits() + { return data_; } + + protected: + node &prot_root_node() + { return data_.root_plus_size_.root_; } + + node const &prot_root_node() const + { return data_.root_plus_size_.root_; } + + void prot_set_size(size_type s) + { data_.root_plus_size_.set_size(s); } + /// @endcond public: @@ -1220,7 +1237,7 @@ class slist_impl //! assigned to the last spliced element or prev if x is empty. //! This iterator can be used as new "prev" iterator for a new splice_after call. //! that will splice new values after the previously spliced values. - void splice(const_iterator it, slist_impl &x, iterator *last = 0) + void splice(const_iterator it, slist_impl &x, const_iterator *last = 0) { this->splice_after(this->previous(it), x, last); } //! Requires: it p must be a valid iterator of *this. @@ -1295,8 +1312,9 @@ class slist_impl { if (node_traits::get_next(node_traits::get_next(this->get_root_node())) != this->get_root_node()) { - slist_impl carry; - slist_impl counter[64]; + + slist_impl carry(this->get_value_traits()); + detail::array_initializer counter(this->get_value_traits()); int fill = 0; const_iterator last_inserted; while(!this->empty()){ @@ -1879,7 +1897,7 @@ class slist_impl //singly linked lists (because "end" is represented by the null pointer) BOOST_STATIC_ASSERT(!linear); root_plus_size *r = detail::parent_from_member - ( detail::get_pointer(end_iterator.pointed_node()), (&root_plus_size::root_)); + ( detail::boost_intrusive_get_pointer(end_iterator.pointed_node()), (&root_plus_size::root_)); data_t *d = detail::parent_from_member ( r, &data_t::root_plus_size_); slist_impl *s = detail::parent_from_member(d, &slist_impl::data_);