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
14#include "arene/base/compiler_support/diagnostics.hpp"
15#include "arene/base/constraints.hpp"
16#include "stdlib/include/stdlib_detail/declval.hpp"
17#include "stdlib/include/stdlib_detail/integral_constant.hpp"
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
33 is_assignable_v<To, From, arene::base::constraints<decltype(std::declval<To>() = std::declval<From>())>> = true;
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>
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>
63extern constexpr bool is_nothrow_assignable_v<To, From, true> = noexcept(std::declval<To>() = std::declval<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>
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
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
ARENE_IGNORE_ARMCLANG("-Wimplicit-int-float-conversion", "No actual conversion here, just a check")
ARENE_IGNORE_CLANG("-Wimplicit-int-conversion", "No actual conversion here, just a check")
constexpr bool is_nothrow_assignable_v
Type trait to detect if an instance of To is assignable to from arguments of From without throwing.
constexpr bool is_nothrow_assignable_v< To, From, true >
Type trait to detect if an instance of To is assignable to from arguments of From without throwing.
constexpr bool is_nothrow_assignable_v
Type trait to detect if an instance of To is assignable to from arguments of From without throwing.
constexpr bool is_assignable_v
Type trait to detect if an instance of To is assignable to from arguments of From.
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