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_CONST_H 1081ad6265SDimitry Andric #define _LIBCPP___TYPE_TRAITS_IS_CONST_H 1181ad6265SDimitry Andric 1281ad6265SDimitry Andric #include <__config> 1381ad6265SDimitry Andric #include <__type_traits/integral_constant.h> 1481ad6265SDimitry Andric 1581ad6265SDimitry Andric #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 1681ad6265SDimitry Andric # pragma GCC system_header 1781ad6265SDimitry Andric #endif 1881ad6265SDimitry Andric 1981ad6265SDimitry Andric _LIBCPP_BEGIN_NAMESPACE_STD 2081ad6265SDimitry Andric 21753f127fSDimitry Andric #if __has_builtin(__is_const) 2281ad6265SDimitry Andric 2381ad6265SDimitry Andric template <class _Tp> 2481ad6265SDimitry Andric struct _LIBCPP_TEMPLATE_VIS is_const : _BoolConstant<__is_const(_Tp)> {}; 2581ad6265SDimitry Andric 26*06c3fb27SDimitry Andric # if _LIBCPP_STD_VER >= 17 2781ad6265SDimitry Andric template <class _Tp> 2881ad6265SDimitry Andric inline constexpr bool is_const_v = __is_const(_Tp); 2981ad6265SDimitry Andric # endif 3081ad6265SDimitry Andric 3181ad6265SDimitry Andric #else 3281ad6265SDimitry Andric 33*06c3fb27SDimitry Andric template <class _Tp> 34*06c3fb27SDimitry Andric struct _LIBCPP_TEMPLATE_VIS is_const : public false_type {}; 35*06c3fb27SDimitry Andric template <class _Tp> 36*06c3fb27SDimitry Andric struct _LIBCPP_TEMPLATE_VIS is_const<_Tp const> : public true_type {}; 3781ad6265SDimitry Andric 38*06c3fb27SDimitry Andric # if _LIBCPP_STD_VER >= 17 3981ad6265SDimitry Andric template <class _Tp> 4081ad6265SDimitry Andric inline constexpr bool is_const_v = is_const<_Tp>::value; 4181ad6265SDimitry Andric # endif 4281ad6265SDimitry Andric 43753f127fSDimitry Andric #endif // __has_builtin(__is_const) 4481ad6265SDimitry Andric 4581ad6265SDimitry Andric _LIBCPP_END_NAMESPACE_STD 4681ad6265SDimitry Andric 4781ad6265SDimitry Andric #endif // _LIBCPP___TYPE_TRAITS_IS_CONST_H 48