Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
disjunction.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_DISJUNCTION_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_TRAITS_DISJUNCTION_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/integral_constant.hpp"
12#include "arene/base/type_traits/conditional.hpp"
13
14namespace arene {
15namespace base {
16
17// parasoft-begin-suppress AUTOSAR-A2_7_3-a "False positive: all declarations are documented."
18/// @brief Combines the values of multiple boolean type traits with a logical OR operation
19/// @tparam BoolTraits the traits to combine
20/// @note Evaluation short circuits: If @c bool(BoolTrait[N]::value) is @c true , then the remaining @c
21/// BoolTraits::value... are not evaluated. The resulting type inherits from either the first @c BoolTraits[N] whose
22/// value is @c true , or the final type in @c BoolTraits... if no such trait exists. If @c BoolTraits... is empty,
23/// then the type is @c std::false_type .
24template <typename...>
25class disjunction : public std::false_type {};
26
27/// @brief Specialization of @c arene::base::disjunction for a single trait. The result is that trait.
28/// @tparam BoolTrait The trait to evaluate
29template <typename BoolTrait>
30class disjunction<BoolTrait> : public BoolTrait {};
31
32/// @brief Specialization of @c arene::base::disjunction for multiple traits.
33/// @tparam BoolTrait The first trait to evaluate
34/// @tparam Rest The remaining traits to evaluate
35template <typename BoolTrait, typename... Rest>
36class disjunction<BoolTrait, Rest...>
37 : public conditional_t<bool(BoolTrait::value), BoolTrait, disjunction<Rest...>> {};
38
39/// @brief The combined value of multiple boolean type traits through a logical OR operation.
40/// @tparam BoolTraits the traits to combine
41/// @returns bool Equivalent to <c> BoolTraits::value || ... </c> .
42/// @note Evaluation short circuits: If @c BoolTrait[N]::value is @c true , then the remaining @c BoolTraits::value...
43/// are not evaluated.
44template <typename... BoolTraits>
45extern constexpr bool disjunction_v{disjunction<BoolTraits...>::value};
46// parasoft-end-suppress AUTOSAR-A2_7_3-a "False positive: all declarations are documented."
47
48} // namespace base
49} // namespace arene
50
51#endif // INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_TRAITS_DISJUNCTION_HPP_
Combines the values of multiple boolean type traits with a logical OR operation.
Definition disjunction.hpp:25
Definition array_exceptions_disabled.cpp:11
constexpr bool disjunction_v
The combined value of multiple boolean type traits through a logical OR operation.
Copyright 2026, Toyota Motor Corporation.
Definition array_exceptions_disabled.cpp:10