di 0.1.0
Loading...
Searching...
No Matches
is_sorted.h
Go to the documentation of this file.
1#pragma once
2
8#include "di/util/move.h"
10
11namespace di::container {
12namespace detail {
13 struct IsSortedFunction {
14 template<concepts::ForwardIterator Iter, concepts::SentinelFor<Iter> Sent, typename Proj = function::Identity,
15 concepts::IndirectStrictWeakOrder<meta::Projected<Iter, Proj>> Comp = function::Compare>
16 constexpr auto operator()(Iter first, Sent last, Comp comp = {}, Proj proj = {}) const -> bool {
17 return container::is_sorted_until(util::move(first), last, util::ref(comp), util::ref(proj)) == last;
18 }
19
20 template<concepts::ForwardContainer Con, typename Proj = function::Identity,
21 concepts::IndirectStrictWeakOrder<meta::Projected<meta::ContainerIterator<Con>, Proj>> Comp =
22 function::Compare>
23 constexpr auto operator()(Con&& container, Comp comp = {}, Proj proj = {}) const -> bool {
24 return (*this)(container::begin(container), container::end(container), util::ref(comp), util::ref(proj));
25 }
26 };
27}
28
29constexpr inline auto is_sorted = detail::IsSortedFunction {};
30}
31
32namespace di {
34}
constexpr auto last(concepts::detail::ConstantVector auto &vector, size_t count)
Definition vector_last.h:13
Definition sequence.h:12
constexpr auto is_sorted_until
Definition is_sorted_until.h:40
constexpr auto is_sorted
Definition is_sorted.h:29
constexpr auto end
Definition end.h:55
constexpr auto begin
Definition begin.h:52
constexpr auto ref
Definition reference_wrapper.h:98
Definition any_storable.h:9
constexpr auto proj
Definition proj.h:59