Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
is_assignable.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_IS_ASSIGNABLE_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_IS_ASSIGNABLE_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
18
19namespace std {
20
22/// @brief Type trait to detect if an instance of @c To is assignable to from arguments of @c From
23/// @tparam To The type of the value to (try to) assign to
24/// @tparam From The type of the value to (try to) assign from
25template <typename To, typename From, typename = arene::base::constraints<>>
26extern constexpr bool is_assignable_v = false;
27
28/// @brief Type trait to detect if an instance of @c To is assignable to from arguments of @c From
29/// @tparam To The type of the value to (try to) assign to
30/// @tparam From The type of the value to (try to) assign from
31template <typename To, typename From>
32extern constexpr bool
34
35} // namespace is_assignable_detail
36
37/// @brief Type trait to detect if an instance of @c To is assignable to from arguments of @c From
38/// @tparam To The type of the value to (try to) assign to
39/// @tparam From The type of the value to (try to) assign from
40template <typename To, typename From>
42
43/// @brief Type trait to detect if an instance of @c To is assignable to from arguments of @c From
44/// @tparam To The type of the value to (try to) assign to
45/// @tparam From The type of the value to (try to) assign from
46template <typename To, typename From>
47class is_assignable : public bool_constant<is_assignable_v<To, From>> {};
48
50/// @brief Type trait to detect if an instance of @c To is assignable to from arguments of @c From without throwing
51/// @tparam To The type of the value to (try to) assign to
52/// @tparam From The type of the value to (try to) assign from
53template <typename To, typename From, bool = is_assignable_v<To, From>>
54extern constexpr bool is_nothrow_assignable_v = false;
55
57ARENE_IGNORE_CLANG("-Wimplicit-int-conversion", "No actual conversion here, just a check");
58ARENE_IGNORE_ARMCLANG("-Wimplicit-int-float-conversion", "No actual conversion here, just a check");
59/// @brief Type trait to detect if an instance of @c To is assignable to from arguments of @c From without throwing
60/// @tparam To The type of the value to (try to) assign to
61/// @tparam From The type of the value to (try to) assign from
62template <typename To, typename From>
65
66} // namespace is_nothrow_assignable_detail
67
68/// @brief Type trait to detect if an instance of @c To is assignable to from arguments of @c From without throwing
69/// @tparam To The type of the value to (try to) assign to
70/// @tparam From The type of the value to (try to) assign from
71template <typename To, typename From>
73
74/// @brief Type trait to detect if an instance of @c To is assignable to from arguments of @c From without throwing
75/// @tparam To The type of the value to (try to) assign to
76/// @tparam From The type of the value to (try to) assign from
77template <typename To, typename From>
78class is_nothrow_assignable : public bool_constant<is_nothrow_assignable_v<To, From>> {};
79
80} // namespace std
81
82#endif // INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_IS_ASSIGNABLE_HPP_
Type trait to detect if an instance of To is assignable to from arguments of From.
Definition is_assignable.hpp:47
Type trait to detect if an instance of To is assignable to from arguments of From without throwing.
Definition is_assignable.hpp:78
Public export header for the constraints subpackage.
Provides macros used to disable and enable compiler specific diagnostics using the _Pragma operator.
#define ARENE_IGNORE_END()
Ends a region of a suppressed diagnostic.
Definition diagnostics.hpp:136
#define ARENE_IGNORE_CLANG(s, comment)
Pushes an ignore for a diagnostic into the compiler for clang only.
Definition diagnostics.hpp:116
#define ARENE_IGNORE_START()
Begins a region of a suppressed diagnostic.
Definition diagnostics.hpp:131
#define ARENE_IGNORE_ARMCLANG(s, comment)
Pushes an ignore for a diagnostic into the compiler for armclang only.
Definition diagnostics.hpp:119
Definition is_assignable.hpp:21
constexpr bool is_assignable_v
Type trait to detect if an instance of To is assignable to from arguments of From.
Definition is_assignable.hpp:49
constexpr bool is_nothrow_assignable_v
Type trait to detect if an instance of To is assignable to from arguments of From without throwing.
STL namespace.
integral_constant< bool, Value > bool_constant
An alias for integral_constant<bool,Value>
Definition integral_constant.hpp:71
constexpr bool is_nothrow_assignable_v
Type trait to detect if an instance of To is assignable to from arguments of From without throwing.
auto declval() noexcept -> T &&
A dummy function that is declared but not defined, with a user-specified return type,...
constexpr bool is_assignable_v
Type trait to detect if an instance of To is assignable to from arguments of From.