Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
is_trivially_copyable.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_TRIVIALLY_COPYABLE_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_IS_TRIVIALLY_COPYABLE_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
16
17namespace std {
18
19/// @brief Type trait to detect if an instance of @c T is trivially copyable
20/// @tparam T The type of the value to check
21/// @note The original C++14 standard says @c volatile qualified types are not trivially copyable. This was changed with
22/// CWG issue 2094, which was accepted as a DR in 2016:
23/// https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#2094 This implementations matches the post-CWG2094
24/// behaviour, which is consistent with C++17 and later too.
25template <typename T>
26extern constexpr bool is_trivially_copyable_v = __is_trivially_copyable(remove_volatile_t<T>);
27
28/// @brief Type trait to detect if an instance of @c T is trivially copyable
29/// @tparam T The type of the value to check
30template <typename T>
31class is_trivially_copyable : public bool_constant<is_trivially_copyable_v<T>> {};
32
33} // namespace std
34
35#endif // INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_IS_TRIVIALLY_COPYABLE_HPP_
Type trait to detect if an instance of T is trivially copyable.
Definition is_trivially_copyable.hpp:31
STL namespace.
integral_constant< bool, Value > bool_constant
An alias for integral_constant<bool,Value>
Definition integral_constant.hpp:71
constexpr bool is_trivially_copyable_v
Type trait to detect if an instance of T is trivially copyable.
typename remove_volatile< Type >::type remove_volatile_t
remove volatile from the provided type. An alias for the modified type.
Definition remove_volatile.hpp:38