Remove some forceinline attributes that might be counter-productive and add noexcept to others.

This commit is contained in:
Ion Gaztañaga
2022-01-04 00:34:33 +01:00
parent 64743a7158
commit afe294063b
8 changed files with 37 additions and 46 deletions

View File

@ -46,14 +46,14 @@ struct avltree_node_cloner
: base_t(f)
{}
BOOST_INTRUSIVE_FORCEINLINE node_ptr operator()(node_ptr p)
node_ptr operator()(node_ptr p)
{
node_ptr n = base_t::get()(p);
NodeTraits::set_balance(n, NodeTraits::get_balance(p));
return n;
}
BOOST_INTRUSIVE_FORCEINLINE node_ptr operator()(node_ptr p) const
node_ptr operator()(node_ptr p) const
{
node_ptr n = base_t::get()(p);
NodeTraits::set_balance(n, NodeTraits::get_balance(p));

View File

@ -233,7 +233,7 @@ class bstree_algorithms : public bstree_algorithms_base<NodeTraits>
//! <b>Complexity</b>: Constant time.
//!
//! <b>Throws</b>: Nothing.
BOOST_INTRUSIVE_FORCEINLINE static node_ptr root_node(const_node_ptr header)
BOOST_INTRUSIVE_FORCEINLINE static node_ptr root_node(const_node_ptr header) BOOST_NOEXCEPT
{
node_ptr p = node_traits::get_parent(header);
return p ? p : detail::uncast(header);
@ -458,8 +458,6 @@ class bstree_algorithms : public bstree_algorithms_base<NodeTraits>
//! the node, since no rebalancing and comparison is needed. Experimental function
BOOST_INTRUSIVE_FORCEINLINE static void replace_node(node_ptr node_to_be_replaced, node_ptr new_node) BOOST_NOEXCEPT
{
if(node_to_be_replaced == new_node)
return;
replace_node(node_to_be_replaced, base_type::get_header(node_to_be_replaced), new_node);
}
@ -479,8 +477,7 @@ class bstree_algorithms : public bstree_algorithms_base<NodeTraits>
//! the node, since no rebalancing or comparison is needed. Experimental function
static void replace_node(node_ptr node_to_be_replaced, node_ptr header, node_ptr new_node) BOOST_NOEXCEPT
{
if(node_to_be_replaced == new_node)
return;
BOOST_ASSERT(node_to_be_replaced != new_node);
//Update header if necessary
if(node_to_be_replaced == NodeTraits::get_left(header)){
@ -567,7 +564,7 @@ class bstree_algorithms : public bstree_algorithms_base<NodeTraits>
//! <b>Throws</b>: Nothing.
//!
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
BOOST_INTRUSIVE_FORCEINLINE static void init(node_ptr node) BOOST_NOEXCEPT
static void init(node_ptr node) BOOST_NOEXCEPT
{
NodeTraits::set_parent(node, node_ptr());
NodeTraits::set_left(node, node_ptr());
@ -579,7 +576,7 @@ class bstree_algorithms : public bstree_algorithms_base<NodeTraits>
//! <b>Complexity</b>: Constant.
//!
//! <b>Throws</b>: Nothing.
BOOST_INTRUSIVE_FORCEINLINE static bool inited(const_node_ptr node)
static bool inited(const_node_ptr node)
{
return !NodeTraits::get_parent(node) &&
!NodeTraits::get_left(node) &&
@ -596,7 +593,7 @@ class bstree_algorithms : public bstree_algorithms_base<NodeTraits>
//! <b>Throws</b>: Nothing.
//!
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
BOOST_INTRUSIVE_FORCEINLINE static void init_header(node_ptr header) BOOST_NOEXCEPT
static void init_header(node_ptr header) BOOST_NOEXCEPT
{
NodeTraits::set_parent(header, node_ptr());
NodeTraits::set_left(header, header);

View File

@ -67,7 +67,7 @@ class circular_list_algorithms
//! <b>Complexity</b>: Constant
//!
//! <b>Throws</b>: Nothing.
BOOST_INTRUSIVE_FORCEINLINE static void init(node_ptr this_node) BOOST_NOEXCEPT
static void init(node_ptr this_node) BOOST_NOEXCEPT
{
const node_ptr null_node = node_ptr();
NodeTraits::set_next(this_node, null_node);
@ -91,7 +91,7 @@ class circular_list_algorithms
//! <b>Complexity</b>: Constant
//!
//! <b>Throws</b>: Nothing.
BOOST_INTRUSIVE_FORCEINLINE static void init_header(node_ptr this_node) BOOST_NOEXCEPT
static void init_header(node_ptr this_node) BOOST_NOEXCEPT
{
NodeTraits::set_next(this_node, this_node);
NodeTraits::set_previous(this_node, this_node);
@ -105,7 +105,7 @@ class circular_list_algorithms
//! <b>Complexity</b>: Constant
//!
//! <b>Throws</b>: Nothing.
BOOST_INTRUSIVE_FORCEINLINE static bool unique(const_node_ptr this_node) BOOST_NOEXCEPT
static bool unique(const_node_ptr this_node) BOOST_NOEXCEPT
{
node_ptr next = NodeTraits::get_next(this_node);
return !next || next == this_node;
@ -137,7 +137,7 @@ class circular_list_algorithms
//! <b>Complexity</b>: Constant
//!
//! <b>Throws</b>: Nothing.
BOOST_INTRUSIVE_FORCEINLINE static node_ptr unlink(node_ptr this_node) BOOST_NOEXCEPT
static node_ptr unlink(node_ptr this_node) BOOST_NOEXCEPT
{
node_ptr next(NodeTraits::get_next(this_node));
node_ptr prev(NodeTraits::get_previous(this_node));
@ -153,7 +153,7 @@ class circular_list_algorithms
//! <b>Complexity</b>: Constant
//!
//! <b>Throws</b>: Nothing.
BOOST_INTRUSIVE_FORCEINLINE static void unlink(node_ptr b, node_ptr e) BOOST_NOEXCEPT
static void unlink(node_ptr b, node_ptr e) BOOST_NOEXCEPT
{
if (b != e) {
node_ptr prevb(NodeTraits::get_previous(b));
@ -169,7 +169,7 @@ class circular_list_algorithms
//! <b>Complexity</b>: Constant
//!
//! <b>Throws</b>: Nothing.
BOOST_INTRUSIVE_FORCEINLINE static void link_before(node_ptr nxt_node, node_ptr this_node) BOOST_NOEXCEPT
static void link_before(node_ptr nxt_node, node_ptr this_node) BOOST_NOEXCEPT
{
node_ptr prev(NodeTraits::get_previous(nxt_node));
NodeTraits::set_previous(this_node, prev);
@ -188,7 +188,7 @@ class circular_list_algorithms
//! <b>Complexity</b>: Constant
//!
//! <b>Throws</b>: Nothing.
BOOST_INTRUSIVE_FORCEINLINE static void link_after(node_ptr prev_node, node_ptr this_node) BOOST_NOEXCEPT
static void link_after(node_ptr prev_node, node_ptr this_node) BOOST_NOEXCEPT
{
node_ptr next(NodeTraits::get_next(prev_node));
NodeTraits::set_previous(this_node, prev_node);
@ -433,14 +433,14 @@ class circular_list_algorithms
}
private:
BOOST_INTRUSIVE_FORCEINLINE static void swap_prev(node_ptr this_node, node_ptr other_node) BOOST_NOEXCEPT
static void swap_prev(node_ptr this_node, node_ptr other_node) BOOST_NOEXCEPT
{
node_ptr temp(NodeTraits::get_previous(this_node));
NodeTraits::set_previous(this_node, NodeTraits::get_previous(other_node));
NodeTraits::set_previous(other_node, temp);
}
BOOST_INTRUSIVE_FORCEINLINE static void swap_next(node_ptr this_node, node_ptr other_node) BOOST_NOEXCEPT
static void swap_next(node_ptr this_node, node_ptr other_node) BOOST_NOEXCEPT
{
node_ptr temp(NodeTraits::get_next(this_node));
NodeTraits::set_next(this_node, NodeTraits::get_next(other_node));

View File

@ -223,7 +223,7 @@ class circular_slist_algorithms
//! <b>Complexity</b>: Linear to the number of elements in the circular list
//!
//! <b>Throws</b>: Nothing.
BOOST_INTRUSIVE_FORCEINLINE static void unlink(node_ptr this_node) BOOST_NOEXCEPT
static void unlink(node_ptr this_node) BOOST_NOEXCEPT
{
if(NodeTraits::get_next(this_node))
base_t::unlink_after(get_previous_node(this_node));

View File

@ -55,16 +55,16 @@ class common_slist_algorithms
BOOST_INTRUSIVE_FORCEINLINE static void init(node_ptr this_node) BOOST_NOEXCEPT
{ NodeTraits::set_next(this_node, node_ptr()); }
BOOST_INTRUSIVE_FORCEINLINE static bool unique(const_node_ptr this_node)
static bool unique(const_node_ptr this_node) BOOST_NOEXCEPT
{
node_ptr next = NodeTraits::get_next(this_node);
return !next || next == this_node;
}
BOOST_INTRUSIVE_FORCEINLINE static bool inited(const_node_ptr this_node)
BOOST_INTRUSIVE_FORCEINLINE static bool inited(const_node_ptr this_node) BOOST_NOEXCEPT
{ return !NodeTraits::get_next(this_node); }
BOOST_INTRUSIVE_FORCEINLINE static void unlink_after(node_ptr prev_node) BOOST_NOEXCEPT
static void unlink_after(node_ptr prev_node) BOOST_NOEXCEPT
{
const_node_ptr this_node(NodeTraits::get_next(prev_node));
NodeTraits::set_next(prev_node, NodeTraits::get_next(this_node));
@ -73,20 +73,20 @@ class common_slist_algorithms
BOOST_INTRUSIVE_FORCEINLINE static void unlink_after(node_ptr prev_node, node_ptr last_node) BOOST_NOEXCEPT
{ NodeTraits::set_next(prev_node, last_node); }
BOOST_INTRUSIVE_FORCEINLINE static void link_after(node_ptr prev_node, node_ptr this_node) BOOST_NOEXCEPT
static void link_after(node_ptr prev_node, node_ptr this_node) BOOST_NOEXCEPT
{
NodeTraits::set_next(this_node, NodeTraits::get_next(prev_node));
NodeTraits::set_next(prev_node, this_node);
}
BOOST_INTRUSIVE_FORCEINLINE static void incorporate_after(node_ptr bp, node_ptr b, node_ptr be)
static void incorporate_after(node_ptr bp, node_ptr b, node_ptr be) BOOST_NOEXCEPT
{
node_ptr p(NodeTraits::get_next(bp));
NodeTraits::set_next(bp, b);
NodeTraits::set_next(be, p);
}
static void transfer_after(node_ptr bp, node_ptr bb, node_ptr be)
static void transfer_after(node_ptr bp, node_ptr bb, node_ptr be) BOOST_NOEXCEPT
{
if (bp != bb && bp != be && bb != be) {
node_ptr next_b = NodeTraits::get_next(bb);

View File

@ -130,7 +130,7 @@ struct prime_list_holder
}
template <class SizeType> //sizeof(SizeType) > sizeof(std::size_t)
static BOOST_INTRUSIVE_FORCEINLINE SizeType suggested_upper_bucket_count_dispatch(SizeType n, detail::true_)
static SizeType suggested_upper_bucket_count_dispatch(SizeType n, detail::true_)
{
std::size_t const c = n > std::size_t(-1)
? std::size_t(-1)
@ -139,7 +139,7 @@ struct prime_list_holder
}
template <class SizeType> //sizeof(SizeType) > sizeof(std::size_t)
static BOOST_INTRUSIVE_FORCEINLINE SizeType suggested_lower_bucket_count_dispatch(SizeType n, detail::true_)
static SizeType suggested_lower_bucket_count_dispatch(SizeType n, detail::true_)
{
std::size_t const c = n > std::size_t(-1)
? std::size_t(-1)
@ -148,7 +148,7 @@ struct prime_list_holder
}
template <class SizeType>
static BOOST_INTRUSIVE_FORCEINLINE SizeType suggested_upper_bucket_count_dispatch(SizeType n, detail::false_)
static SizeType suggested_upper_bucket_count_dispatch(SizeType n, detail::false_)
{
std::size_t const c = suggested_upper_bucket_count_impl(static_cast<std::size_t>(n));
return truncate_size_type<SizeType>(c, detail::bool_<(sizeof(SizeType) < sizeof(std::size_t))>());
@ -156,7 +156,7 @@ struct prime_list_holder
}
template <class SizeType>
static BOOST_INTRUSIVE_FORCEINLINE SizeType suggested_lower_bucket_count_dispatch(SizeType n, detail::false_)
static SizeType suggested_lower_bucket_count_dispatch(SizeType n, detail::false_)
{
std::size_t const c = suggested_lower_bucket_count_impl(static_cast<std::size_t>(n));
return truncate_size_type<SizeType>(c, detail::bool_<(sizeof(SizeType) < sizeof(std::size_t))>());
@ -445,9 +445,7 @@ struct group_functions
}
BOOST_INTRUSIVE_FORCEINLINE static node_ptr next_group_if_first_in_group(node_ptr ptr)
{
return node_traits::get_next(group_traits::get_next(ptr));
}
{ return node_traits::get_next(group_traits::get_next(ptr)); }
BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_first_in_group(node_ptr n, detail::false_)
{ return n; }
@ -458,7 +456,7 @@ struct group_functions
static void insert_in_group(node_ptr, node_ptr, false_)
{}
BOOST_INTRUSIVE_FORCEINLINE static node_ptr split_group(node_ptr const new_first_in_group)
static node_ptr split_group(node_ptr const new_first_in_group)
{
node_ptr const first((get_first_in_group)(new_first_in_group, detail::true_()));
if(first != new_first_in_group){
@ -525,10 +523,10 @@ BOOST_INTRUSIVE_FORCEINLINE std::size_t hash_to_bucket(std::size_t hash_value, s
{ return hash_value & (bucket_cnt - 1); }
template<bool Power2Buckets, bool Incremental>
BOOST_INTRUSIVE_FORCEINLINE std::size_t hash_to_bucket_split(std::size_t hash_value, std::size_t bucket_cnt, std::size_t split)
std::size_t hash_to_bucket_split(std::size_t hash_value, std::size_t bucket_cnt, std::size_t split)
{
std::size_t bucket_number = detail::hash_to_bucket(hash_value, bucket_cnt, detail::bool_<Power2Buckets>());
if(Incremental)
BOOST_IF_CONSTEXPR(Incremental)
bucket_number -= static_cast<std::size_t>(bucket_number >= split)*(bucket_cnt/2);
return bucket_number;
}
@ -1242,9 +1240,7 @@ struct bucket_hash_equal_t<ValueTraits, VoidOrKeyOfValue, VoidOrKeyHash, VoidOrK
{ this->cached_begin_ = this->bucket_hash_type::priv_invalid_bucket(); }
BOOST_INTRUSIVE_FORCEINLINE void priv_swap_cache(bucket_hash_equal_t &other)
{
::boost::adl_move_swap(this->cached_begin_, other.cached_begin_);
}
{ ::boost::adl_move_swap(this->cached_begin_, other.cached_begin_); }
siterator priv_begin() const
{
@ -1476,9 +1472,7 @@ struct hashdata_internal
//public functions
BOOST_INTRUSIVE_FORCEINLINE SizeType split_count() const BOOST_NOEXCEPT
{
return this->priv_split_traits().get_size();
}
{ return this->priv_split_traits().get_size(); }
BOOST_INTRUSIVE_FORCEINLINE iterator iterator_to(reference value) BOOST_NOEXCEPT
{

View File

@ -548,7 +548,7 @@ class list_impl
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Does not affect the validity of iterators and references.
BOOST_INTRUSIVE_FORCEINLINE void swap(list_impl& other) BOOST_NOEXCEPT
void swap(list_impl& other) BOOST_NOEXCEPT
{
node_algorithms::swap_nodes(this->get_root_node(), other.get_root_node());
this->priv_size_traits().swap(other.priv_size_traits());
@ -1363,7 +1363,7 @@ class list_impl
BOOST_INTRUSIVE_INVARIANT_ASSERT(this->priv_size_traits().get_size() == node_count);
}
BOOST_INTRUSIVE_FORCEINLINE friend bool operator==(const list_impl &x, const list_impl &y)
friend bool operator==(const list_impl &x, const list_impl &y)
{
if(constant_time_size && x.size() != y.size()){
return false;

View File

@ -54,7 +54,7 @@ struct rbtree_node_cloner
: base_t(f)
{}
BOOST_INTRUSIVE_FORCEINLINE node_ptr operator()(node_ptr p)
node_ptr operator()(node_ptr p)
{
node_ptr n = base_t::get()(p);
NodeTraits::set_color(n, NodeTraits::get_color(p));
@ -273,7 +273,7 @@ class rbtree_algorithms
#endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
//! @copydoc ::boost::intrusive::bstree_algorithms::init_header(node_ptr)
BOOST_INTRUSIVE_FORCEINLINE static void init_header(node_ptr header) BOOST_NOEXCEPT
static void init_header(node_ptr header) BOOST_NOEXCEPT
{
bstree_algo::init_header(header);
NodeTraits::set_color(header, NodeTraits::red());