Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
conjunction.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_CONJUNCTION_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_TRAITS_CONJUNCTION_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 AND operation
19/// @tparam BoolTraits the traits to combine
20/// @note Evaluation short circuits: If @c bool(BoolTrait[N]::value) is @c false , then the remaining
21/// @c BoolTraits::value... are not evaluated. The resulting type inherits from either the first @c BoolTraits[N] whose
22/// value is @c false , or the final type in @c BoolTraits... if no such trait exists. If @c BoolTraits is empty,
23/// then the type is @c std::true_type .
24template <typename...>
25class conjunction : public std::true_type {};
26
27/// @brief Specialization of @c arene::base::conjunction for a single trait. The result is that trait.
28/// @tparam BoolTrait The trait to evaluate
29template <typename BoolTrait>
30class conjunction<BoolTrait> : public BoolTrait {};
31
32/// @brief Specialization of @c arene::base::conjunction 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 conjunction<BoolTrait, Rest...>
37 : public conditional_t<bool(BoolTrait::value), conjunction<Rest...>, BoolTrait> {};
38
39/// @brief The combined value of multiple boolean type traits
40/// @tparam BoolTraits the traits to combine
41/// @returns bool Equivalent to <c> BoolTraits::value && ... </c> .
42/// @note Evaluation short circuits: If @c bool(BoolTrait[N]::value) is @c false , then the remaining
43/// @c BoolTraits::value... are not evaluated.
44template <typename... BoolTraits>
45extern constexpr bool conjunction_v{conjunction<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_CONJUNCTION_HPP_
Combines the values of multiple boolean type traits with a logical AND operation.
Definition conjunction.hpp:25
Definition array_exceptions_disabled.cpp:11
constexpr bool conjunction_v
The combined value of multiple boolean type traits.
Copyright 2026, Toyota Motor Corporation.
Definition array_exceptions_disabled.cpp:10