Iros
 
Loading...
Searching...
No Matches
includes.h
Go to the documentation of this file.
1#pragma once
2
7
8namespace di::container {
9namespace detail {
11 template<concepts::InputIterator It1, concepts::SentinelFor<It1> Sent1, concepts::InputIterator It2,
12 concepts::SentinelFor<It2> Sent2, typename Proj1 = function::Identity,
13 typename Proj2 = function::Identity,
14 concepts::IndirectStrictWeakOrder<meta::Projected<It1, Proj1>, meta::Projected<It2, Proj2>> Comp =
15 function::Compare>
16 constexpr auto operator()(It1 first1, Sent1 last1, It2 first2, Sent2 last2, Comp comp = {}, Proj1 proj1 = {},
17 Proj2 proj2 = {}) const -> bool {
18 // While both ranges are non-empty, see if every element of range 2 is in range 1.
19 while (first1 != last1 && first2 != last2) {
20 auto result =
21 function::invoke(comp, function::invoke(proj1, *first1), function::invoke(proj2, *first2));
22 if (result > 0) {
23 return false;
24 }
25 if (result == 0) {
26 ++first1;
27 ++first2;
28 } else {
29 ++first1;
30 }
31 }
32 return first2 == last2;
33 }
34
35 template<concepts::InputContainer Con1, concepts::InputContainer Con2, typename Proj1 = function::Identity,
36 typename Proj2 = function::Identity,
37 concepts::IndirectStrictWeakOrder<meta::Projected<meta::ContainerIterator<Con1>, Proj1>,
38 meta::Projected<meta::ContainerIterator<Con2>, Proj2>>
39 Comp = function::Compare>
40 constexpr auto operator()(Con1&& container1, Con2&& container2, Comp comp = {}, Proj1 proj1 = {},
41 Proj2 proj2 = {}) const -> bool {
42 return (*this)(container::begin(container1), container::end(container1), container::begin(container2),
43 container::end(container2), util::ref(comp), util::ref(proj1), util::ref(proj2));
44 }
45 };
46}
47
48constexpr inline auto includes = detail::IncludesFunction {};
49}
Definition sequence.h:13
Definition sequence.h:12
constexpr auto end
Definition end.h:47
constexpr auto includes
Definition includes.h:48
constexpr auto begin
Definition begin.h:44
constexpr auto invoke
Definition invoke.h:100
constexpr auto ref
Definition reference_wrapper.h:98
constexpr auto operator()(It1 first1, Sent1 last1, It2 first2, Sent2 last2, Comp comp={}, Proj1 proj1={}, Proj2 proj2={}) const -> bool
Definition includes.h:16
constexpr auto operator()(Con1 &&container1, Con2 &&container2, Comp comp={}, Proj1 proj1={}, Proj2 proj2={}) const -> bool
Definition includes.h:40