Add forceinline to trivial functions.

This commit is contained in:
Ion Gaztañaga
2026-03-17 11:46:42 +01:00
parent 0ee02823ad
commit 2897bad30a
28 changed files with 42 additions and 45 deletions
@@ -65,7 +65,7 @@ bool segmented_equal_ref
}
template <class InpIter1, class Sent, class InpIter2, class Tag>
typename algo_enable_if_c<
BOOST_CONTAINER_FORCEINLINE typename algo_enable_if_c<
!Tag::value || is_sentinel<Sent, InpIter1>::value, bool>::type
segmented_equal_ref
(InpIter1 first1, Sent last1, InpIter2& first2, Tag)
@@ -78,7 +78,7 @@ segmented_equal_ref
//! Returns \c true if elements in [first1, last1) are equal to the
//! range starting at \c first2. Exploits segmentation on the first range.
template <class InpIter1, class Sent, class InpIter2>
inline bool segmented_equal(InpIter1 first1, Sent last1, InpIter2 first2)
BOOST_CONTAINER_FORCEINLINE bool segmented_equal(InpIter1 first1, Sent last1, InpIter2 first2)
{
typedef segmented_iterator_traits<InpIter1> traits;
return detail_algo::segmented_equal_ref(first1, last1, first2,
@@ -30,7 +30,7 @@ namespace container {
//! When \c Iter is a segmented iterator, exploits segmentation
//! to reduce per-element overhead.
template <class FwdIt, class Sent, class T>
inline void segmented_fill(FwdIt first, Sent last, const T& value)
BOOST_CONTAINER_FORCEINLINE void segmented_fill(FwdIt first, Sent last, const T& value)
{
(segmented_generate)(first, last, detail_algo::constref_generator<T>(value));
}
@@ -29,7 +29,7 @@ namespace container {
//! Returns an iterator to the first element equal to \c value
//! in [first, last), or \c last if not found.
template <class InpIter, class Sent, class T>
inline InpIter segmented_find(InpIter first, Sent last, const T& value)
BOOST_CONTAINER_FORCEINLINE InpIter segmented_find(InpIter first, Sent last, const T& value)
{
return boost::container::segmented_find_if(first, last, equal_to_value<T>(value));
}
@@ -89,7 +89,7 @@ segmented_find_if_dispatch
//! Returns an iterator to the first element satisfying \c pred
//! in [first, last), or \c last if not found.
template <class InpIter, class Sent, class Pred>
inline InpIter segmented_find_if(InpIter first, Sent last, Pred pred)
BOOST_CONTAINER_FORCEINLINE InpIter segmented_find_if(InpIter first, Sent last, Pred pred)
{
typedef segmented_iterator_traits<InpIter> traits;
return detail_algo::segmented_find_if_dispatch(first, last, pred,
@@ -29,7 +29,7 @@ namespace container {
//! Returns an iterator to the first element for which \c pred
//! returns false in [first, last), or \c last if not found.
template <class InpIter, class Sent, class Pred>
inline InpIter segmented_find_if_not(InpIter first, Sent last, Pred pred)
BOOST_CONTAINER_FORCEINLINE InpIter segmented_find_if_not(InpIter first, Sent last, Pred pred)
{
return boost::container::segmented_find_if(first, last, not_pred<Pred>(pred));
}
@@ -67,7 +67,7 @@ segmented_for_each_dispatch
//! When \c Iter is a segmented iterator, exploits segmentation
//! to reduce per-element overhead.
template <class InpIter, class Sent, class F>
inline F segmented_for_each(InpIter first, Sent last, F f)
BOOST_CONTAINER_FORCEINLINE F segmented_for_each(InpIter first, Sent last, F f)
{
typedef segmented_iterator_traits<InpIter> traits;
return detail_algo::segmented_for_each_dispatch(first, last, f,
@@ -71,7 +71,7 @@ segmented_generate_ref(FwdIt first, Sent last, Generator& gen, Tag)
//! element in [first, last).
//! Generator state is preserved across segment boundaries.
template <class FwdIt, class Sent, class Generator>
inline void segmented_generate(FwdIt first, Sent last, Generator gen)
BOOST_CONTAINER_FORCEINLINE void segmented_generate(FwdIt first, Sent last, Generator gen)
{
typedef segmented_iterator_traits<FwdIt> traits;
detail_algo::segmented_generate_ref(first, last, gen,
@@ -75,7 +75,7 @@ bool segmented_is_partitioned_dispatch
}
template <class InpIter, class Sent, class Pred, class Tag>
typename algo_enable_if_c<
BOOST_CONTAINER_FORCEINLINE typename algo_enable_if_c<
!Tag::value || is_sentinel<Sent, InpIter>::value, bool>::type
segmented_is_partitioned_dispatch
(InpIter first, Sent last, Pred pred, Tag)
@@ -91,7 +91,7 @@ segmented_is_partitioned_dispatch
//! partitioned with respect to \c pred.
//! Exploits segmentation when available.
template <class InpIter, class Sent, class Pred>
inline bool segmented_is_partitioned(InpIter first, Sent last, Pred pred)
BOOST_CONTAINER_FORCEINLINE bool segmented_is_partitioned(InpIter first, Sent last, Pred pred)
{
typedef segmented_iterator_traits<InpIter> traits;
return detail_algo::segmented_is_partitioned_dispatch(first, last, pred,
@@ -27,14 +27,14 @@ namespace container {
//! Returns true if [first, last) is sorted according to \c comp.
template <class FwdIt, class Sent, class Comp>
inline bool segmented_is_sorted(FwdIt first, Sent last, Comp comp)
BOOST_CONTAINER_FORCEINLINE bool segmented_is_sorted(FwdIt first, Sent last, Comp comp)
{
return boost::container::segmented_is_sorted_until(first, last, comp) == last;
}
//! Returns true if [first, last) is sorted using operator<.
template <class FwdIt, class Sent>
inline bool segmented_is_sorted(FwdIt first, Sent last)
BOOST_CONTAINER_FORCEINLINE bool segmented_is_sorted(FwdIt first, Sent last)
{
return boost::container::segmented_is_sorted_until(first, last) == last;
}
@@ -140,7 +140,7 @@ segmented_is_sorted_until_dispatch
//! in [first, last), using \c comp for comparison.
//! Returns \c last if the range is sorted.
template <class FwdIt, class Sent, class Comp>
inline FwdIt segmented_is_sorted_until(FwdIt first, Sent last, Comp comp)
BOOST_CONTAINER_FORCEINLINE FwdIt segmented_is_sorted_until(FwdIt first, Sent last, Comp comp)
{
typedef segmented_iterator_traits<FwdIt> traits;
return detail_algo::segmented_is_sorted_until_dispatch(first, last, comp,
@@ -151,7 +151,7 @@ inline FwdIt segmented_is_sorted_until(FwdIt first, Sent last, Comp comp)
//! in [first, last), using operator<.
//! Returns \c last if the range is sorted.
template <class FwdIt, class Sent>
inline FwdIt segmented_is_sorted_until(FwdIt first, Sent last)
BOOST_CONTAINER_FORCEINLINE FwdIt segmented_is_sorted_until(FwdIt first, Sent last)
{
typedef segmented_iterator_traits<FwdIt> traits;
return detail_algo::segmented_is_sorted_until_dispatch(first, last,
@@ -115,7 +115,7 @@ segmented_merge_dispatch
} // namespace detail_algo
template <class InIter1, class Sent1, class InIter2, class Sent2, class OutIter, class Comp>
inline OutIter segmented_merge
BOOST_CONTAINER_FORCEINLINE OutIter segmented_merge
(InIter1 first1, Sent1 last1, InIter2 first2, Sent2 last2, OutIter result, Comp comp)
{
typedef segmented_iterator_traits<InIter1> traits;
@@ -124,7 +124,7 @@ inline OutIter segmented_merge
}
template <class InIter1, class Sent1, class InIter2, class Sent2, class OutIter>
inline OutIter segmented_merge
BOOST_CONTAINER_FORCEINLINE OutIter segmented_merge
(InIter1 first1, Sent1 last1, InIter2 first2, Sent2 last2, OutIter result)
{
return boost::container::segmented_merge(first1, last1, first2, last2, result,
@@ -97,7 +97,7 @@ segmented_partition_dispatch
//! \c pred come before those that do not (Lomuto-style partition).
//! Returns an iterator to the partition point.
template <class FwdIt, class Sent, class Pred>
inline FwdIt segmented_partition(FwdIt first, Sent last, Pred pred)
BOOST_CONTAINER_FORCEINLINE FwdIt segmented_partition(FwdIt first, Sent last, Pred pred)
{
typedef segmented_iterator_traits<FwdIt> traits;
return detail_algo::segmented_partition_dispatch(first, last, pred,
@@ -94,7 +94,7 @@ segmented_partition_copy_dispatch
//! depending on whether \c pred returns true or false.
//! Returns a pair of output iterators past the last elements written.
template <class InIter, class Sent, class OutIter1, class OutIter2, class Pred>
inline std::pair<OutIter1, OutIter2>
BOOST_CONTAINER_FORCEINLINE std::pair<OutIter1, OutIter2>
segmented_partition_copy(InIter first, Sent last, OutIter1 out_true, OutIter2 out_false, Pred pred)
{
typedef segmented_iterator_traits<InIter> traits;
@@ -77,7 +77,7 @@ segmented_partition_point_dispatch
//! for which \c pred returns false. The range must be partitioned
//! with respect to \c pred.
template <class FwdIt, class Sent, class Predicate>
inline FwdIt segmented_partition_point(FwdIt first, Sent last, Predicate pred)
BOOST_CONTAINER_FORCEINLINE FwdIt segmented_partition_point(FwdIt first, Sent last, Predicate pred)
{
typedef segmented_iterator_traits<FwdIt> traits;
return detail_algo::segmented_partition_point_dispatch(first, last, pred,
@@ -29,7 +29,7 @@ namespace container {
//! Removes all elements equal to \c value from [first, last),
//! moving retained elements forward. Returns iterator to new end.
template <class FwdIt, class Sent, class T>
inline FwdIt segmented_remove(FwdIt first, Sent last, const T& value)
BOOST_CONTAINER_FORCEINLINE FwdIt segmented_remove(FwdIt first, Sent last, const T& value)
{
return boost::container::segmented_remove_if(first, last, equal_to_value<T>(value));
}
@@ -30,7 +30,7 @@ namespace container {
//! skipping elements equal to \c value. Returns the output iterator past
//! the last element written.
template <class InIter, class Sent, class OutIter, class T>
inline OutIter segmented_remove_copy(InIter first, Sent last, OutIter result, const T& value)
BOOST_CONTAINER_FORCEINLINE OutIter segmented_remove_copy(InIter first, Sent last, OutIter result, const T& value)
{
return boost::container::segmented_remove_copy_if(first, last, result, equal_to_value<T>(value));
}
@@ -70,7 +70,7 @@ segmented_remove_copy_if_dispatch
//! skipping elements satisfying \c pred. Returns the output iterator past
//! the last element written.
template <class InIter, class Sent, class OutIter, class Pred>
inline OutIter segmented_remove_copy_if(InIter first, Sent last, OutIter result, Pred pred)
BOOST_CONTAINER_FORCEINLINE OutIter segmented_remove_copy_if(InIter first, Sent last, OutIter result, Pred pred)
{
typedef segmented_iterator_traits<InIter> traits;
return detail_algo::segmented_remove_copy_if_dispatch(first, last, result, pred,
@@ -33,7 +33,7 @@ namespace container {
//! Removes all elements for which \c pred returns true from [first, last),
//! moving retained elements forward. Returns iterator to new end.
template <class FwdIt, class Sent, class Predicate>
inline FwdIt segmented_remove_if(FwdIt first, Sent last, Predicate pred)
BOOST_CONTAINER_FORCEINLINE FwdIt segmented_remove_if(FwdIt first, Sent last, Predicate pred)
{
first = segmented_find_if(first, last, pred);
if (first == last)
@@ -28,7 +28,7 @@ namespace container {
//! Replaces every occurrence of \c old_val with \c new_val in [first, last).
template <class FwdIt, class Sent, class T>
inline void segmented_replace
BOOST_CONTAINER_FORCEINLINE void segmented_replace
(FwdIt first, Sent last, const T& old_val, const T& new_val)
{
boost::container::segmented_replace_if(first, last, equal_to_value<T>(old_val), new_val);
@@ -63,7 +63,7 @@ segmented_replace_if_dispatch
//! Replaces every element satisfying \c pred with \c new_val in [first, last).
template <class FwdIt, class Sent, class Pred, class T>
inline void segmented_replace_if(FwdIt first, Sent last, Pred pred, const T& new_val)
BOOST_CONTAINER_FORCEINLINE void segmented_replace_if(FwdIt first, Sent last, Pred pred, const T& new_val)
{
typedef segmented_iterator_traits<FwdIt> traits;
detail_algo::segmented_replace_if_dispatch(first, last, pred, new_val,
@@ -114,7 +114,7 @@ void segmented_reverse_dispatch(SegIt first, SegIt last, segmented_iterator_tag)
//! When the iterator is segmented, exploits segmentation on both
//! the forward and backward sides to reduce per-element overhead.
template <class BidirIter>
void segmented_reverse(BidirIter first, BidirIter last)
BOOST_CONTAINER_FORCEINLINE void segmented_reverse(BidirIter first, BidirIter last)
{
typedef segmented_iterator_traits<BidirIter> traits;
detail_algo::segmented_reverse_dispatch(first, last,
@@ -82,7 +82,7 @@ OutIter segmented_reverse_copy_dispatch
//! each local range without per-element segment-boundary overhead.
//! Returns the output iterator past the last element written.
template <class BidirIter, class OutIter>
inline OutIter segmented_reverse_copy(BidirIter first, BidirIter last, OutIter result)
BOOST_CONTAINER_FORCEINLINE OutIter segmented_reverse_copy(BidirIter first, BidirIter last, OutIter result)
{
typedef segmented_iterator_traits<BidirIter> traits;
return detail_algo::segmented_reverse_copy_dispatch(first, last, result,
@@ -131,7 +131,7 @@ segmented_search_dispatch
//! Finds the first occurrence of the subsequence [s_first, s_last) in [first, last).
//! Returns an iterator to the beginning of the found subsequence, or \c last if not found.
template <class FwdIt1, class Sent1, class FwdIt2, class Sent2>
inline FwdIt1 segmented_search
BOOST_CONTAINER_FORCEINLINE FwdIt1 segmented_search
(FwdIt1 first, Sent1 last, FwdIt2 s_first, Sent2 s_last)
{
typedef segmented_iterator_traits<FwdIt1> traits;
@@ -147,7 +147,7 @@ segmented_search_n_dispatch
//! Finds the first occurrence of \c count consecutive elements equal to \c value
//! in [first, last). Returns an iterator to the start of the run, or \c last if not found.
template <class FwdIt, class Sent, class Size, class T>
inline FwdIt segmented_search_n
BOOST_CONTAINER_FORCEINLINE FwdIt segmented_search_n
(FwdIt first, Sent last, Size count, const T& value)
{
typedef segmented_iterator_traits<FwdIt> traits;
@@ -38,7 +38,7 @@ namespace detail_algo {
struct set_intersection_default_less
{
template <class T>
bool operator()(const T& a, const T& b) const { return a < b; }
BOOST_CONTAINER_FORCEINLINE bool operator()(const T& a, const T& b) const { return a < b; }
};
template <class FwdIt, class InIter2, class Sent2, class OutIter, class Comp>
@@ -77,7 +77,7 @@ void set_intersection_scan(SegIt first, SegIt last, InIter2& first2, Sent2 last2
}
template <class SegIter, class InIter2, class Sent2, class OutIter, class Comp>
OutIter segmented_set_intersection_dispatch
BOOST_CONTAINER_FORCEINLINE OutIter segmented_set_intersection_dispatch
(SegIter first1, SegIter last1, InIter2 first2, Sent2 last2, OutIter result, Comp comp, segmented_iterator_tag)
{
set_intersection_scan(first1, last1, first2, last2, result, comp, segmented_iterator_tag());
@@ -101,7 +101,7 @@ segmented_set_intersection_dispatch
} // namespace detail_algo
template <class InIter1, class Sent1, class InIter2, class Sent2, class OutIter, class Comp>
inline OutIter segmented_set_intersection
BOOST_CONTAINER_FORCEINLINE OutIter segmented_set_intersection
(InIter1 first1, Sent1 last1, InIter2 first2, Sent2 last2, OutIter result, Comp comp)
{
typedef segmented_iterator_traits<InIter1> traits;
@@ -110,7 +110,7 @@ inline OutIter segmented_set_intersection
}
template <class InIter1, class Sent1, class InIter2, class Sent2, class OutIter>
inline OutIter segmented_set_intersection
BOOST_CONTAINER_FORCEINLINE OutIter segmented_set_intersection
(InIter1 first1, Sent1 last1, InIter2 first2, Sent2 last2, OutIter result)
{
return boost::container::segmented_set_intersection(first1, last1, first2, last2, result,
@@ -63,10 +63,10 @@ struct sp_chained_composer
OuterComposer outer_;
typename Traits::segment_iterator seg_;
sp_chained_composer(OuterComposer o, typename Traits::segment_iterator s)
BOOST_CONTAINER_FORCEINLINE sp_chained_composer(OuterComposer o, typename Traits::segment_iterator s)
: outer_(o), seg_(s) {}
result_type operator()(typename Traits::local_iterator l) const
BOOST_CONTAINER_FORCEINLINE result_type operator()(typename Traits::local_iterator l) const
{ return outer_(Traits::compose(seg_, l)); }
};
@@ -118,20 +118,17 @@ OuterIter stable_partition_scan(SegIt first, SegIt last, OuterIter result,
}
template <class SegIter, class Pred>
SegIter segmented_stable_partition_dispatch
BOOST_CONTAINER_FORCEINLINE SegIter segmented_stable_partition_dispatch
(SegIter first, SegIter last, Pred pred, segmented_iterator_tag)
{
SegIter result = first;
sp_identity_composer<SegIter> composer;
return stable_partition_scan(first, last, result, composer, pred, segmented_iterator_tag());
return stable_partition_scan(first, last, first, sp_identity_composer<SegIter>(), pred, segmented_iterator_tag());
}
template <class BidirIt, class Pred>
BidirIt segmented_stable_partition_dispatch
BOOST_CONTAINER_FORCEINLINE BidirIt segmented_stable_partition_dispatch
(BidirIt first, BidirIt last, Pred pred, non_segmented_iterator_tag)
{
sp_identity_composer<BidirIt> composer;
return stable_partition_scan(first, last, first, composer, pred, non_segmented_iterator_tag());
return stable_partition_scan(first, last, first, sp_identity_composer<BidirIt>(), pred, non_segmented_iterator_tag());
}
} // namespace detail_algo
@@ -140,7 +137,7 @@ BidirIt segmented_stable_partition_dispatch
//! \c pred come before those that do not, preserving relative order
//! within each group. Returns an iterator to the partition point.
template <class BidirIt, class Pred>
inline BidirIt segmented_stable_partition(BidirIt first, BidirIt last, Pred pred)
BOOST_CONTAINER_FORCEINLINE BidirIt segmented_stable_partition(BidirIt first, BidirIt last, Pred pred)
{
typedef segmented_iterator_traits<BidirIt> traits;
return detail_algo::segmented_stable_partition_dispatch(first, last, pred,
@@ -68,7 +68,7 @@ segmented_swap_ranges_dispatch
//! Returns an iterator past the last swapped element in the second range.
//! Segmentation is exploited on the first range.
template <class FwdIt1, class Sent, class FwdIt2>
inline FwdIt2 segmented_swap_ranges(FwdIt1 first1, Sent last1, FwdIt2 first2)
BOOST_CONTAINER_FORCEINLINE FwdIt2 segmented_swap_ranges(FwdIt1 first1, Sent last1, FwdIt2 first2)
{
typedef segmented_iterator_traits<FwdIt1> traits;
return detail_algo::segmented_swap_ranges_dispatch(first1, last1, first2,
@@ -70,7 +70,7 @@ segmented_transform_dispatch
//! to the range beginning at \c result.
//! Segmentation is exploited on the input range only.
template <class InIter, class Sent, class OutIter, class UnaryOp>
inline OutIter segmented_transform
BOOST_CONTAINER_FORCEINLINE OutIter segmented_transform
(InIter first, Sent last, OutIter result, UnaryOp op)
{
typedef segmented_iterator_traits<InIter> traits;