1 //===-- is_scalar 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_SCALAR_H 9 #define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_SCALAR_H 10 11 #include "src/__support/CPP/type_traits/bool_constant.h" 12 #include "src/__support/CPP/type_traits/is_arithmetic.h" 13 #include "src/__support/CPP/type_traits/is_enum.h" 14 #include "src/__support/CPP/type_traits/is_member_pointer.h" 15 #include "src/__support/CPP/type_traits/is_null_pointer.h" 16 #include "src/__support/CPP/type_traits/is_pointer.h" 17 #include "src/__support/macros/attributes.h" 18 #include "src/__support/macros/config.h" 19 20 namespace LIBC_NAMESPACE_DECL { 21 namespace cpp { 22 23 // is_scalar 24 template <class T> 25 struct is_scalar 26 : cpp::bool_constant<cpp::is_arithmetic_v<T> || cpp::is_enum_v<T> || 27 cpp::is_pointer_v<T> || cpp::is_member_pointer_v<T> || 28 cpp::is_null_pointer_v<T>> {}; 29 template <class T> 30 LIBC_INLINE_VAR constexpr bool is_scalar_v = is_scalar<T>::value; 31 32 } // namespace cpp 33 } // namespace LIBC_NAMESPACE_DECL 34 35 #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_SCALAR_H 36