Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
is_copyable.hpp
Go to the documentation of this file.
1// Copyright 2026, Toyota Motor Corporation
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_TRAITS_IS_COPYABLE_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_TRAITS_IS_COPYABLE_HPP_
7
8// IWYU pragma: private, include "arene/base/type_traits.hpp"
9// IWYU pragma: friend "(arene/base(?!/tests)|stdlib/include/stdlib_detail)/.*"
10
11#include "arene/base/constraints/constraints.hpp"
12#include "arene/base/stdlib_choice/enable_if.hpp"
13#include "arene/base/stdlib_choice/is_assignable.hpp"
14#include "arene/base/stdlib_choice/is_copy_constructible.hpp"
15#include "arene/base/stdlib_choice/is_object.hpp"
16#include "arene/base/type_traits/is_movable.hpp"
17
18namespace arene {
19namespace base {
20
21/// @brief Backport for the C++20 copyable concept
22///
23/// @tparam T The type to test
24///
25/// The concept copyable<T> specifies that T is a movable object type that can also be copied (that is, it supports copy
26/// construction and copy assignment).
27///
28/// @{
29template <class T, class = arene::base::constraints<>>
30extern constexpr bool is_copyable_v = false;
31
32// Note: This is implemented with a constraint on std::is_object as some non-objects are not referenceable (e.g. void).
33template <class T>
34extern constexpr bool is_copyable_v<T, arene::base::constraints<std::enable_if_t<std::is_object<T>::value>>> =
36 std::is_assignable<T&, T const&>::value && std::is_assignable<T&, T const>::value;
37/// @}
38
39} // namespace base
40} // namespace arene
41#endif // INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_TRAITS_IS_COPYABLE_HPP_
Definition array_exceptions_disabled.cpp:11
constexpr bool is_copyable_v
Backport for the C++20 copyable concept.
Copyright 2026, Toyota Motor Corporation.
Definition array_exceptions_disabled.cpp:10