Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
add_rvalue_reference.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_ADD_RVALUE_REFERENCE_HPP_
6
#
define
INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_ADD_RVALUE_REFERENCE_HPP_
7
8
#
include
"arene/base/constraints.hpp"
9
10
// parasoft-begin-suppress CERT_CPP-DCL58-a-2 "Part of a standard library implementation"
11
// parasoft-begin-suppress AUTOSAR-A17_6_1-a-2 "Part of a standard library implementation"
12
13
// IWYU pragma: private, include <type_traits>
14
// IWYU pragma: friend "stdlib_detail/.*"
15
16
namespace
std
{
17
namespace
add_rvalue_reference_detail
{
18
19
// parasoft-begin-suppress AUTOSAR-A2_7_3-a "False positive: all declarations
20
// and typedefs *are* preceded by a comment with @brief"
21
22
/// @brief Base case when @c Type is not referenceable.
23
/// @tparam Type The type to add an rvalue reference to
24
template
<
typename
Type,
class
=
arene
::
base
::
constraints
<>>
25
class
add_rvalue_reference
{
26
public
:
27
/// @brief The resulting type
28
using
type = Type;
29
};
30
31
/// @brief Add an rvalue reference onto @c Type
32
/// @tparam Type The type to add an rvalue reference to
33
template
<
typename
Type
>
34
class
add_rvalue_reference
<
Type
,
arene
::
base
::
constraints
<
Type
&&>> {
35
public
:
36
/// @brief The resulting type
37
using
type
=
Type
&&;
38
};
39
40
}
// namespace add_rvalue_reference_detail
41
42
/// @brief Add an rvalue reference onto @c Type
43
/// @tparam Type The type to add an rvalue reference to
44
///
45
/// @c add_rvalue_reference works with both referenceable and non-referenceable types. Referenceable types are types in
46
/// one of three categories:
47
/// 1. object types
48
/// 2. function types that are not cv-ref qualified.
49
/// 3. reference types
50
///
51
/// For category 3, this should follow reference collapsing rules.
52
///
53
/// Any type not in one of these three categories is a "non-referenceable" type. For example, void.
54
/// For non-referenceable types, @c add_rvalue_reference will return back the input type.
55
///
56
template
<
typename
Type
>
57
using
add_rvalue_reference
=
add_rvalue_reference_detail
::
add_rvalue_reference
<
Type
>;
58
59
/// @brief Add an rvalue reference onto @c Type
60
/// @tparam Type The type to add an rvalue reference to
61
template
<
typename
Type
>
62
using
add_rvalue_reference_t
=
typename
add_rvalue_reference
<
Type
>::
type
;
63
64
// parasoft-end-suppress AUTOSAR-A2_7_3-a
65
66
}
// namespace std
67
68
#
endif
// INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_ADD_RVALUE_REFERENCE_HPP_
std::add_rvalue_reference_detail::add_rvalue_reference
Base case when Type is not referenceable.
Definition
add_rvalue_reference.hpp:25
std::add_rvalue_reference_detail
Definition
add_rvalue_reference.hpp:17
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
add_rvalue_reference.hpp
Generated by
1.13.2