5#ifndef INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_PARTIAL_SORT_COPY_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_PARTIAL_SORT_COPY_HPP_
15#include "arene/base/algorithm/detail/traits.hpp"
18#include "arene/base/functional/detail/operator_less.hpp"
58 typename SourceIterator,
59 typename TargetIterator,
66 arene::base::algorithm_detail::iter_reference_t<TargetIterator>,
67 arene::base::algorithm_detail::iter_reference_t<SourceIterator>>>,
74 arene::base::algorithm_detail::iter_reference_t<SourceIterator>,
75 arene::base::algorithm_detail::iter_reference_t<TargetIterator>>>,
80 SourceIterator source_begin,
81 SourceIterator source_end,
82 TargetIterator target_begin,
83 TargetIterator target_end,
86 if ((target_begin == target_end) || (source_begin == source_end)) {
89 auto current_last = target_begin;
90 auto const target_last = target_end - 1;
91 *current_last = *source_begin;
94 auto const next_last = current_last + 1;
96 bool const is_room{current_last != target_last};
97 bool const new_is_smaller{target_pos != next_last};
98 if ((!new_is_smaller) && (!is_room)) {
102 current_last = next_last;
105 if (new_is_smaller) {
106 ignore = arene::base::rotate(target_pos, current_last, current_last + 1);
109 return current_last + 1;
132 typename SourceIterator,
133 typename TargetIterator,
139 arene::base::algorithm_detail::iter_reference_t<TargetIterator>,
140 arene::base::algorithm_detail::iter_reference_t<SourceIterator>>>,
146 SourceIterator source_begin,
147 SourceIterator source_end,
148 TargetIterator target_begin,
149 TargetIterator target_end
156 arene::base::functional_detail::operator_less
Public export header for the constraints subpackage.
constexpr bool is_compare_v
determines if a type satisfies the Compare named requirement
constexpr auto make_subrange(Iterator iterator, Sentinel sentinel) noexcept(std::is_nothrow_move_constructible< Iterator >::value &&//std::is_nothrow_move_constructible< Sentinel >::value) -> make_subrange_detail::iterator_range< Iterator, Sentinel >
Combine an iterator and sentinel into a range type that can be used with range-based for loops.
Definition make_subrange.hpp:98
constexpr bool is_less_than_comparable_v
typename constraints_impl::constraints< EnableIfs... >::type constraints
Helper used to express template constraints in a consistent way using std::enable_if_t.
Definition constraints.hpp:51
constexpr auto lower_bound(ForwardIterator first, ForwardIterator last, T const &value, Compare comp) noexcept(noexcept(std::internal::partition_point(std::move(first), std::move(last), arene::base::bind_back_detail::bind_back_t< Compare, T const & >(comp, value)))) -> ForwardIterator
returns an iterator to the first element not less than the given value
Definition lower_bound.hpp:63
constexpr auto move(T &&value) noexcept -> remove_reference_t< T > &&
Cast a value to an rvalue.
Definition move.hpp:30
typename enable_if< Condition, Type >::type enable_if_t
Type alias to support constraining templates. Is an alias for the specified type if the Condition is ...
Definition enable_if.hpp:41
constexpr bool is_assignable_v
Type trait to detect if an instance of To is assignable to from arguments of From.
auto partial_sort_copy(SourceIterator source_begin, SourceIterator source_end, TargetIterator target_begin, TargetIterator target_end, Comparator comp) -> TargetIterator
Copy the first K elements from the source range, as sorted with respect to the supplied comparator,...
Definition partial_sort_copy.hpp:79
static constexpr auto const & ignore
An object to which anything can be assigned, which ignores the assigned value.
Definition ignore.hpp:72
constexpr auto forward(remove_reference_t< T > &value) noexcept -> T &&
Cast a value to an rvalue if T is an rvalue or rvalue reference, otherwise forward an lvalue referenc...
Definition forward.hpp:24