Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
is_binary_predicate.hpp
Go to the documentation of this file.
1// Copyright 2026, Toyota Motor Corporation
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_TRAITS_IS_BINARY_PREDICATE_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_TRAITS_IS_BINARY_PREDICATE_HPP_
7
8// IWYU pragma: private, include "arene/base/type_traits.hpp"
9// IWYU pragma: friend "(arene/base(?!/tests)|stdlib/include/stdlib_detail)/.*"
10
11#include "arene/base/stdlib_choice/is_copy_constructible.hpp"
12#include "arene/base/stdlib_choice/is_move_constructible.hpp"
13#include "arene/base/type_traits/is_predicate.hpp"
14#include "arene/base/type_traits/remove_cvref.hpp"
15// IWYU pragma: no_include "arene/base/stdlib_choice/remove_cv.hpp"
16// IWYU pragma: no_include "arene/base/stdlib_choice/remove_reference.hpp"
17
18namespace arene {
19namespace base {
20
21/// @brief determines if a type satisfies the BinaryPredicate named requirement
22/// @tparam F the possible binary predicate function object
23/// @tparam T1 type of the first argument
24/// @tparam T2 type of the second argument
25///
26/// BinaryPredicate is a set of requirements expected by some of the standard
27/// library facilities from the user-provided function object types.
28///
29/// Given a BinaryPredicate @c pred and a pair of iterators @c iter1 and
30/// @c iter2 or an iterator @c iter and a (possibly const) value @c value, the
31/// type and value category of the expression <c> pred(*iter1, *iter2) </c> or,
32/// respectively, <c> pred(*iter, value) </c>, must meet the BooleanTestable
33/// requirements.
34///
35/// In addition, evaluation of that expression is not allowed to call non-const
36/// member functions of the dereferenced iterators; syntactically, the predicate
37/// must accept const object arguments, with the same behavior regardless of
38/// whether its arguments are const or non-const.
39///
40/// A type satisfies BinaryPredicate if
41/// * the type satisfies Predicate
42/// * the type satisfies CopyConstructible
43///
44/// @{
45template <class F, class T1, class T2 = T1>
46extern constexpr bool is_binary_predicate_v = //
47 is_predicate_v<F, T1, T2> &&
49 F,
50 remove_cvref_t<T1> const&,
51 remove_cvref_t<T2> const&> &&
54/// @}
55
56} // namespace base
57} // namespace arene
58#endif // INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_TRAITS_IS_BINARY_PREDICATE_HPP_
Definition array_exceptions_disabled.cpp:11
constexpr bool is_binary_predicate_v
determines if a type satisfies the BinaryPredicate named requirement
Copyright 2026, Toyota Motor Corporation.
Definition array_exceptions_disabled.cpp:10