181ad6265SDimitry Andric //===----------------------------------------------------------------------===// 281ad6265SDimitry Andric // 381ad6265SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 481ad6265SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 581ad6265SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 681ad6265SDimitry Andric // 781ad6265SDimitry Andric //===----------------------------------------------------------------------===// 881ad6265SDimitry Andric 981ad6265SDimitry Andric #ifndef _LIBCPP___TYPE_TRAITS_IS_ARRAY_H 1081ad6265SDimitry Andric #define _LIBCPP___TYPE_TRAITS_IS_ARRAY_H 1181ad6265SDimitry Andric 1281ad6265SDimitry Andric #include <__config> 1381ad6265SDimitry Andric #include <__type_traits/integral_constant.h> 1481ad6265SDimitry Andric #include <cstddef> 1581ad6265SDimitry Andric 1681ad6265SDimitry Andric #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 1781ad6265SDimitry Andric # pragma GCC system_header 1881ad6265SDimitry Andric #endif 1981ad6265SDimitry Andric 2081ad6265SDimitry Andric _LIBCPP_BEGIN_NAMESPACE_STD 2181ad6265SDimitry Andric 2281ad6265SDimitry Andric // TODO: Clang incorrectly reports that __is_array is true for T[0]. 2381ad6265SDimitry Andric // Re-enable the branch once https://llvm.org/PR54705 is fixed. 24753f127fSDimitry Andric #if __has_builtin(__is_array) && 0 2581ad6265SDimitry Andric 2681ad6265SDimitry Andric template <class _Tp> 2781ad6265SDimitry Andric struct _LIBCPP_TEMPLATE_VIS is_array : _BoolConstant<__is_array(_Tp)> {}; 2881ad6265SDimitry Andric 29*06c3fb27SDimitry Andric # if _LIBCPP_STD_VER >= 17 3081ad6265SDimitry Andric template <class _Tp> 3181ad6265SDimitry Andric inline constexpr bool is_array_v = __is_array(_Tp); 3281ad6265SDimitry Andric # endif 3381ad6265SDimitry Andric 3481ad6265SDimitry Andric #else 3581ad6265SDimitry Andric 36*06c3fb27SDimitry Andric template <class _Tp> 37*06c3fb27SDimitry Andric struct _LIBCPP_TEMPLATE_VIS is_array : public false_type {}; 38*06c3fb27SDimitry Andric template <class _Tp> 39*06c3fb27SDimitry Andric struct _LIBCPP_TEMPLATE_VIS is_array<_Tp[]> : public true_type {}; 40*06c3fb27SDimitry Andric template <class _Tp, size_t _Np> 41*06c3fb27SDimitry Andric struct _LIBCPP_TEMPLATE_VIS is_array<_Tp[_Np]> : public true_type {}; 4281ad6265SDimitry Andric 43*06c3fb27SDimitry Andric # if _LIBCPP_STD_VER >= 17 4481ad6265SDimitry Andric template <class _Tp> 4581ad6265SDimitry Andric inline constexpr bool is_array_v = is_array<_Tp>::value; 4681ad6265SDimitry Andric # endif 4781ad6265SDimitry Andric 48753f127fSDimitry Andric #endif // __has_builtin(__is_array) 4981ad6265SDimitry Andric 5081ad6265SDimitry Andric _LIBCPP_END_NAMESPACE_STD 5181ad6265SDimitry Andric 5281ad6265SDimitry Andric #endif // _LIBCPP___TYPE_TRAITS_IS_ARRAY_H 53