Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
enable_if.hpp
Go to the documentation of this file.
1
// Copyright 2024, Toyota Motor Corporation
2
//
3
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5
#
ifndef
INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_ENABLE_IF_HPP_
6
#
define
INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_ENABLE_IF_HPP_
7
8
// parasoft-begin-suppress CERT_CPP-DCL58-a-2 "Part of a standard library implementation"
9
// parasoft-begin-suppress AUTOSAR-A17_6_1-a-2 "Part of a standard library implementation"
10
11
// IWYU pragma: private, include <type_traits>
12
// IWYU pragma: friend "stdlib_detail/.*"
13
14
namespace
std
{
15
/// @brief Class to support constraining templates. Has a @c type member of the specified type if the @c Condition is @c
16
/// true and no @c type member if the @c Condition is @c false
17
/// @tparam Condition the condition to check
18
/// @tparam Type the type of the member
19
template
<
bool
Condition,
typename
Type =
void
>
20
class
enable_if
{};
21
22
/// @brief Specialization of a class to support constraining templates for the case that the condition is @c true which
23
/// has a @c type member of the specified type
24
/// @tparam Type the type of the member
25
template
<
typename
Type>
26
class
enable_if
<
true
, Type> {
27
public
:
28
// parasoft-begin-suppress AUTOSAR-A2_10_1-e "False positive: type is not hiding any identifier"
29
/// @brief The result type
30
using
type = Type;
31
// parasoft-end-suppress AUTOSAR-A2_10_1-e "False positive: type is not hiding any identifier"
32
};
33
34
// parasoft-begin-suppress AUTOSAR-A2_7_3-a-2 "False positive: There is an @brief tag"
35
/// @brief Type alias to support constraining templates. Is an alias for the specified type if the @c Condition is @c
36
/// true and is not defined if the @c Condition is @c false
37
/// @tparam Condition the condition to check
38
/// @tparam Type the type of the result
39
template
<
bool
Condition,
typename
Type =
void
>
40
// parasoft-begin-suppress AUTOSAR-A2_10_1-e-2 "False positive: enable_if_t is not hiding any identifier"
41
using
enable_if_t =
typename
enable_if
<Condition, Type>::type;
42
// parasoft-end-suppress AUTOSAR-A2_10_1-e-2
43
// parasoft-end-suppress AUTOSAR-A2_7_3-a-2
44
45
}
// namespace std
46
#
endif
// INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_ENABLE_IF_HPP_
std::enable_if
Class to support constraining templates. Has a type member of the specified type if the Condition is ...
Definition
enable_if.hpp:20
std::hash<::arene::base::result< void, E > >::operator()
constexpr auto operator()(::arene::base::result< void, E > const &value) const noexcept(noexcept(hash< E >{}(std::declval< E const & >()))) -> std::size_t
Calculate the hash of a result.
Definition
result.hpp:1827
stdlib
include
stdlib_detail
enable_if.hpp
Generated by
1.13.2