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