di 0.1.0
Loading...
Searching...
No Matches
is_sorted_until.h
Go to the documentation of this file.
1#pragma once
2
7#include "di/util/move.h"
9
10namespace di::container {
11namespace detail {
12 struct IsSortedUntilFunction {
13 template<concepts::ForwardIterator Iter, concepts::SentinelFor<Iter> Sent, typename Proj = function::Identity,
14 concepts::IndirectStrictWeakOrder<meta::Projected<Iter, Proj>> Comp = function::Compare>
15 constexpr auto operator()(Iter it, Sent last, Comp comp = {}, Proj proj = {}) const -> Iter {
16 if (it == last) {
17 return it;
18 }
19
20 auto next = it;
21 while (++next != last) {
23 return next;
24 }
25 it = next;
26 }
27 return next;
28 }
29
30 template<concepts::ForwardContainer Con, typename Proj = function::Identity,
31 concepts::IndirectStrictWeakOrder<meta::Projected<meta::ContainerIterator<Con>, Proj>> Comp =
32 function::Compare>
33 constexpr auto operator()(Con&& container, Comp comp = {}, Proj proj = {}) const
35 return (*this)(container::begin(container), container::end(container), util::ref(comp), util::ref(proj));
36 }
37 };
38}
39
40constexpr inline auto is_sorted_until = detail::IsSortedUntilFunction {};
41}
42
43namespace di {
45}
Definition sequence.h:12
constexpr auto next
Definition next.h:35
constexpr auto is_sorted_until
Definition is_sorted_until.h:40
constexpr auto end
Definition end.h:55
constexpr auto begin
Definition begin.h:52
constexpr auto invoke
Definition invoke.h:100
Conditional< concepts::BorrowedContainer< Con >, ContainerIterator< Con >, container::Dangling > BorrowedIterator
Definition borrowed_iterator.h:11
constexpr auto ref
Definition reference_wrapper.h:98
Definition any_storable.h:9
constexpr auto proj
Definition proj.h:59