7#ifndef INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_IS_SORTED_HPP_
8#define INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_IS_SORTED_HPP_
13#include "arene/base/algorithm/detail/traits.hpp"
15#include "arene/base/functional/detail/operator_less.hpp"
44 typename ForwardIterator,
50 typename std::iterator_traits<ForwardIterator>::reference>>
52auto is_sorted(ForwardIterator first, ForwardIterator last, Comparator comp)
noexcept(
53 noexcept(first != last) &&
54 noexcept(arene::base::advance(first, 1)) &&
55 noexcept(comp(*first, *first)) &&
60 ForwardIterator prev{first};
61 arene::base::advance(first, 1);
62 while (first != last) {
63 if (comp(*first, *prev)) {
67 arene::base::advance(first, 1);
84 typename ForwardIterator,
88 decltype(arene::base::functional_detail::operator_less)&,
90auto is_sorted(ForwardIterator first, ForwardIterator last)
noexcept(
Provides a backport of C++17's constexpr std::advance.
provides a uniform interface to the properties of an iterator
Definition iterator_traits.hpp:90
Public export header for the constraints subpackage.
constexpr bool is_compare_v
determines if a type satisfies the Compare named requirement
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 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_nothrow_copy_assignable_v
Type trait to detect if an instance of T is copy assignable without throwing.
constexpr bool is_nothrow_copy_constructible_v
Type trait to detect if an instance of T is copy constructible without throwing.
auto is_sorted(ForwardIterator first, ForwardIterator last, Comparator comp) noexcept(noexcept(first !=last) &&//noexcept(arene::base::advance(first, 1)) &&//noexcept(comp(*first, *first)) &&//is_nothrow_copy_constructible_v< ForwardIterator > &&//is_nothrow_copy_assignable_v< ForwardIterator >) -> bool
Check if a range is sorted. Returns false if there are any pair of sequential elements i and j such t...
Definition is_sorted.hpp:52