diff --git a/include/boost/intrusive/bstree.hpp b/include/boost/intrusive/bstree.hpp index ecd3999..a4e4c83 100644 --- a/include/boost/intrusive/bstree.hpp +++ b/include/boost/intrusive/bstree.hpp @@ -184,14 +184,14 @@ struct bstbase3 static const_iterator s_iterator_to(const_reference value) { BOOST_STATIC_ASSERT((!stateful_value_traits)); - return const_iterator (value_traits::to_node_ptr(const_cast (value)), const_value_traits_ptr()); + return const_iterator (value_traits::to_node_ptr(*pointer_traits::const_cast_from(pointer_traits::pointer_to(value))), const_value_traits_ptr()); } iterator iterator_to(reference value) { return iterator (this->get_value_traits().to_node_ptr(value), this->value_traits_ptr()); } const_iterator iterator_to(const_reference value) const - { return const_iterator (this->get_value_traits().to_node_ptr(const_cast (value)), this->value_traits_ptr()); } + { return const_iterator (this->get_value_traits().to_node_ptr(*pointer_traits::const_cast_from(pointer_traits::pointer_to(value))), this->value_traits_ptr()); } static void init_node(reference value) { node_algorithms::init(value_traits::to_node_ptr(value)); } @@ -223,7 +223,7 @@ struct bstbase2 const value_compare &comp() const { return this->get(); } - + value_compare &comp() { return this->get(); } @@ -489,7 +489,7 @@ struct bstbase_hack const size_traits &sz_traits() const { return s_size_traits; } - + static size_traits s_size_traits; }; @@ -822,7 +822,7 @@ class bstree_impl //! //! Throws: If value_compare copy-constructor throws. key_compare key_comp() const; - + //! Effects: Returns the value_compare object used by the container. //! //! Complexity: Constant. @@ -1492,7 +1492,7 @@ class bstree_impl //! Throws: If `comp` throws. template iterator lower_bound(const KeyType &key, KeyValueCompare comp); - + //! Effects: Returns a const iterator to the first element whose //! key is not less than k or end() if that element does not exist. //! @@ -1634,7 +1634,7 @@ class bstree_impl //! Requires: KeyValueCompare is a function object that induces a strict weak //! ordering compatible with the strict weak ordering used to create the - //! the container. + //! the container. //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false. //! @@ -1678,7 +1678,7 @@ class bstree_impl //! Requires: KeyValueCompare is a function object that induces a strict weak //! ordering compatible with the strict weak ordering used to create the - //! the container. + //! the container. //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false. //! diff --git a/include/boost/intrusive/list.hpp b/include/boost/intrusive/list.hpp index 01e0b49..b21dc85 100644 --- a/include/boost/intrusive/list.hpp +++ b/include/boost/intrusive/list.hpp @@ -1213,8 +1213,8 @@ class list_impl static const_iterator s_iterator_to(const_reference value) { BOOST_STATIC_ASSERT((!stateful_value_traits)); - BOOST_INTRUSIVE_INVARIANT_ASSERT(!node_algorithms::inited(value_traits::to_node_ptr(const_cast (value)))); - return const_iterator(value_traits::to_node_ptr(const_cast (value)), const_value_traits_ptr()); + BOOST_INTRUSIVE_INVARIANT_ASSERT(!node_algorithms::inited(value_traits::to_node_ptr(*pointer_traits::const_cast_from(pointer_traits::pointer_to(value))))); + return const_iterator(value_traits::to_node_ptr(*pointer_traits::const_cast_from(pointer_traits::pointer_to(value))), const_value_traits_ptr()); } //! Requires: value must be a reference to a value inserted in a list. @@ -1243,8 +1243,8 @@ class list_impl //! Note: Iterators and references are not invalidated. const_iterator iterator_to(const_reference value) const { - BOOST_INTRUSIVE_INVARIANT_ASSERT(!node_algorithms::inited(this->priv_value_traits().to_node_ptr(const_cast (value)))); - return const_iterator(this->priv_value_traits().to_node_ptr(const_cast (value)), value_traits_ptr()); + BOOST_INTRUSIVE_INVARIANT_ASSERT(!node_algorithms::inited(this->priv_value_traits().to_node_ptr(*pointer_traits::const_cast_from(pointer_traits::pointer_to(value))))); + return const_iterator(this->priv_value_traits().to_node_ptr(*pointer_traits::const_cast_from(pointer_traits::pointer_to(value))), value_traits_ptr()); } /// @cond diff --git a/include/boost/intrusive/slist.hpp b/include/boost/intrusive/slist.hpp index 23c7824..cf5b3db 100644 --- a/include/boost/intrusive/slist.hpp +++ b/include/boost/intrusive/slist.hpp @@ -1686,7 +1686,7 @@ class slist_impl static const_iterator s_iterator_to(const_reference value) { BOOST_STATIC_ASSERT((!stateful_value_traits)); - return const_iterator(value_traits::to_node_ptr(const_cast (value)), const_value_traits_ptr()); + return const_iterator(value_traits::to_node_ptr(*pointer_traits::const_cast_from(pointer_traits::pointer_to(value))), const_value_traits_ptr()); } //! Requires: value must be a reference to a value inserted in a list. @@ -1715,8 +1715,8 @@ class slist_impl //! Note: Iterators and references are not invalidated. const_iterator iterator_to(const_reference value) const { - BOOST_INTRUSIVE_INVARIANT_ASSERT (linear || !node_algorithms::inited(this->priv_value_traits().to_node_ptr(const_cast (value)))); - return const_iterator(this->priv_value_traits().to_node_ptr(const_cast (value)), this->value_traits_ptr()); + BOOST_INTRUSIVE_INVARIANT_ASSERT (linear || !node_algorithms::inited(this->priv_value_traits().to_node_ptr(*pointer_traits::const_cast_from(pointer_traits::pointer_to(value))))); + return const_iterator(this->priv_value_traits().to_node_ptr(*pointer_traits::const_cast_from(pointer_traits::pointer_to(value))), this->value_traits_ptr()); } //! Returns: The iterator to the element before i in the list.