5 #ifndef VCCC_ALGORITHM_RANGES_EQUAL_HPP
6 #define VCCC_ALGORITHM_RANGES_EQUAL_HPP
9 #include <initializer_list>
10 #include <type_traits>
32 struct equal_niebloid {
34 template<
typename R1,
typename R2,
typename Pred,
typename Proj1,
typename Proj2,
35 bool = conjunction<input_range<R1>, input_range<R2>>
::value >
36 struct check_range : std::false_type {};
37 template<
typename R1,
typename R2,
typename Pred,
typename Proj1,
typename Proj2>
38 struct check_range<R1, R2, Pred, Proj1, Proj2, true>
39 : indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> {};
41 template<
typename I1,
typename S1,
typename I2,
typename S2>
42 constexpr
bool compare_size(I1 first1, S1 last1, I2 first2, S2 last2, std::true_type )
const {
45 template<
typename I1,
typename S1,
typename I2,
typename S2>
46 constexpr
bool compare_size(I1, S1, I2, S2, std::false_type )
const {
56 typename I1,
typename S1,
57 typename I2,
typename S2,
58 typename Pred = ranges::equal_to,
59 typename Proj1 = identity,
typename Proj2 = identity,
60 std::enable_if_t<conjunction<
61 input_iterator<I1>, sentinel_for<S1, I1>,
62 input_iterator<I2>, sentinel_for<S2, I2>,
63 indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
67 operator()(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {})
const {
68 if (!compare_size(first1, last1, first2, last2, conjunction<sized_sentinel_for<S1, I1>, sized_sentinel_for<S2, I2>>{}))
71 for (; first1 != last1; ++first1, (void)++first2) {
85 typename Pred = ranges::equal_to,
90 operator()(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {})
const {
92 std::ref(pred), std::ref(proj1), std::ref(proj2));
98 typename Pred = equal_to,
99 typename Proj1 = identity,
typename Proj2 = identity,
100 std::enable_if_t<check_range<std::initializer_list<T>, R2, Pred, Proj1, Proj2>
::value,
int> = 0
103 operator()(std::initializer_list<T>&& il, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {})
const {
105 std::ref(pred), std::ref(proj1), std::ref(proj2));
111 typename Pred = equal_to,
112 typename Proj1 = identity,
typename Proj2 = identity,
113 std::enable_if_t<check_range<R1, std::initializer_list<U>, Pred, Proj1, Proj2>
::value,
int> = 0
116 operator()(R1&& r1, std::initializer_list<U> il, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {})
const {
118 std::ref(pred), std::ref(proj1), std::ref(proj2));
124 typename Pred = equal_to,
125 typename Proj1 = identity,
typename Proj2 = identity,
126 std::enable_if_t<check_range<std::initializer_list<T>, std::initializer_list<U>, Pred, Proj1, Proj2>
::value,
int> = 0
129 operator()(std::initializer_list<T> il1, std::initializer_list<U> il2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {})
const {
131 std::ref(pred), std::ref(proj1), std::ref(proj2));
constexpr VCCC_INLINE_OR_STATIC detail::equal_niebloid equal
Two ranges are considered equal if they have the same number of elements and every pair of correspond...
Definition: equal.hpp:142
constexpr invoke_result_t< F, Args... > invoke(F &&f, Args &&... args) noexcept(is_nothrow_invocable< F, Args... >::value)
Definition: invoke.hpp:38
constexpr VCCC_INLINE_OR_STATIC detail::begin_niebloid begin
returns an iterator to the beginning of a range
Definition: begin.hpp:116
constexpr VCCC_INLINE_OR_STATIC detail::distance_niebloid distance
Definition: distance.hpp:72
constexpr VCCC_INLINE_OR_STATIC detail::end_niebloid end
returns a sentinel indicating the end of a range
Definition: end.hpp:120
#define VCCC_INLINE_OR_STATIC
Definition: inline_or_static.hpp:9
Definition: directory.h:12
constexpr VCCC_INLINE_OR_STATIC detail::element_niebloid< 1 > value
Definition: key_value.hpp:35
#define VCCC_NODISCARD
Definition: nodiscard.hpp:14
function object that returns its argument unchanged
Definition: identity.hpp:25