11#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_ALGORITHM_EQUAL_HPP_
12#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_ALGORITHM_EQUAL_HPP_
18#include "arene/base/compiler_support/attributes.hpp"
19#include "arene/base/compiler_support/cpp14_inline.hpp"
20#include "arene/base/iterator/distance.hpp"
21#include "arene/base/stdlib_choice/equal_to.hpp"
22#include "arene/base/stdlib_choice/iterator_tags.hpp"
23#include "arene/base/stdlib_choice/iterator_traits.hpp"
24#include "arene/base/stdlib_choice/move.hpp"
29namespace equal_detail {
50template <
typename Itr1,
typename Itr2,
typename BinaryPredicate>
51ARENE_NODISCARD
constexpr auto do_equal(Itr1 first_itr, Itr1 first_end, Itr2 second_itr, BinaryPredicate cmp) ->
bool {
52 while (first_itr != first_end) {
53 if (!cmp(*first_itr, *second_itr)) {
81template <
typename Itr1,
typename Itr2,
typename BinaryPredicate>
82ARENE_NODISCARD
constexpr auto do_equal(
83 std::input_iterator_tag,
86 std::input_iterator_tag,
91 while (first_itr != first_end && second_itr != second_end) {
92 if (!cmp(*first_itr, *second_itr)) {
98 return first_itr == first_end && second_itr == second_end;
119template <
typename Itr1,
typename Itr2,
typename BinaryPredicate>
120ARENE_NODISCARD
constexpr auto do_equal(
121 std::random_access_iterator_tag,
124 std::random_access_iterator_tag,
131 return (::arene::base::distance(first_itr, first_end) == ::arene::base::distance(second_itr, second_end)) &&
132 do_equal(first_itr, first_end, second_itr, std::move(cmp));
153 template <
typename Itr1,
typename Itr2>
154 ARENE_NODISCARD
constexpr auto operator()(Itr1 first_start, Itr1 first_end, Itr2 second_start)
const noexcept
156 return (*
this)(first_start, first_end, second_start, std::equal_to<>{});
176 template <
typename Itr1,
typename Itr2,
typename BinaryPredicate>
177 ARENE_NODISCARD
constexpr auto operator()(Itr1 first_start, Itr1 first_end, Itr2 second_start, BinaryPredicate cmp)
178 const noexcept ->
bool {
179 return do_equal(first_start, first_end, second_start, std::move(cmp));
194 template <
typename Itr1,
typename Itr2>
195 ARENE_NODISCARD
constexpr auto operator()(Itr1 first_start, Itr1 first_end, Itr2 second_start, Itr2 second_end)
196 const noexcept ->
bool {
197 return (*
this)(first_start, first_end, second_start, second_end, std::equal_to<>{});
216 template <
typename Itr1,
typename Itr2,
typename BinaryPredicate>
217 ARENE_NODISCARD
constexpr auto
218 operator()(Itr1 first_start, Itr1 first_end, Itr2 second_start, Itr2 second_end, BinaryPredicate cmp)
const noexcept
221 typename std::iterator_traits<Itr1>::iterator_category{},
224 typename std::iterator_traits<Itr2>::iterator_category{},
237ARENE_CPP14_INLINE_VARIABLE(equal_detail::equal_fn, equal);
Definition array_exceptions_disabled.cpp:11
Copyright 2026, Toyota Motor Corporation.
Definition array_exceptions_disabled.cpp:10