1 //===----------------------------------------------------------------------===// 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 9 #ifndef _LIBCPP___TYPE_TRAITS_IS_OBJECT_H 10 #define _LIBCPP___TYPE_TRAITS_IS_OBJECT_H 11 12 #include <__config> 13 #include <__type_traits/integral_constant.h> 14 #include <__type_traits/is_array.h> 15 #include <__type_traits/is_class.h> 16 #include <__type_traits/is_scalar.h> 17 #include <__type_traits/is_union.h> 18 19 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 20 # pragma GCC system_header 21 #endif 22 23 _LIBCPP_BEGIN_NAMESPACE_STD 24 25 #if __has_builtin(__is_object) 26 27 template<class _Tp> 28 struct _LIBCPP_TEMPLATE_VIS is_object : _BoolConstant<__is_object(_Tp)> { }; 29 30 #if _LIBCPP_STD_VER >= 17 31 template <class _Tp> 32 inline constexpr bool is_object_v = __is_object(_Tp); 33 #endif 34 35 #else // __has_builtin(__is_object) 36 37 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_object 38 : public integral_constant<bool, is_scalar<_Tp>::value || 39 is_array<_Tp>::value || 40 is_union<_Tp>::value || 41 is_class<_Tp>::value > {}; 42 43 #if _LIBCPP_STD_VER >= 17 44 template <class _Tp> 45 inline constexpr bool is_object_v = is_object<_Tp>::value; 46 #endif 47 48 #endif // __has_builtin(__is_object) 49 50 _LIBCPP_END_NAMESPACE_STD 51 52 #endif // _LIBCPP___TYPE_TRAITS_IS_OBJECT_H 53