• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- is_copy_assignable type_traits --------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 #ifndef LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_COPY_ASSIGNABLE_H
9 #define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_COPY_ASSIGNABLE_H
10 
11 #include "src/__support/CPP/type_traits/add_lvalue_reference.h"
12 #include "src/__support/CPP/type_traits/integral_constant.h"
13 #include "src/__support/macros/config.h"
14 
15 namespace LIBC_NAMESPACE_DECL {
16 namespace cpp {
17 
18 // is copy assignable
19 template <class T>
20 struct is_copy_assignable
21     : public integral_constant<
22           bool, __is_assignable(cpp::add_lvalue_reference_t<T>,
23                                 cpp::add_lvalue_reference_t<const T>)> {};
24 
25 template <class T>
26 LIBC_INLINE_VAR constexpr bool is_copy_assignable_v =
27     is_copy_assignable<T>::value;
28 
29 } // namespace cpp
30 } // namespace LIBC_NAMESPACE_DECL
31 
32 #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_COPY_ASSIGNABLE_H
33