1*81ad6265SDimitry Andric //===----------------------------------------------------------------------===// 2*81ad6265SDimitry Andric // 3*81ad6265SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*81ad6265SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 5*81ad6265SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*81ad6265SDimitry Andric // 7*81ad6265SDimitry Andric //===----------------------------------------------------------------------===// 8*81ad6265SDimitry Andric 9*81ad6265SDimitry Andric #ifndef _LIBCPP___TYPE_TRAITS_IS_CONST_H 10*81ad6265SDimitry Andric #define _LIBCPP___TYPE_TRAITS_IS_CONST_H 11*81ad6265SDimitry Andric 12*81ad6265SDimitry Andric #include <__config> 13*81ad6265SDimitry Andric #include <__type_traits/integral_constant.h> 14*81ad6265SDimitry Andric 15*81ad6265SDimitry Andric #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 16*81ad6265SDimitry Andric # pragma GCC system_header 17*81ad6265SDimitry Andric #endif 18*81ad6265SDimitry Andric 19*81ad6265SDimitry Andric _LIBCPP_BEGIN_NAMESPACE_STD 20*81ad6265SDimitry Andric 21*81ad6265SDimitry Andric #if __has_keyword(__is_const) 22*81ad6265SDimitry Andric 23*81ad6265SDimitry Andric template <class _Tp> 24*81ad6265SDimitry Andric struct _LIBCPP_TEMPLATE_VIS is_const : _BoolConstant<__is_const(_Tp)> { }; 25*81ad6265SDimitry Andric 26*81ad6265SDimitry Andric #if _LIBCPP_STD_VER > 14 27*81ad6265SDimitry Andric template <class _Tp> 28*81ad6265SDimitry Andric inline constexpr bool is_const_v = __is_const(_Tp); 29*81ad6265SDimitry Andric #endif 30*81ad6265SDimitry Andric 31*81ad6265SDimitry Andric #else 32*81ad6265SDimitry Andric 33*81ad6265SDimitry Andric template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_const : public false_type {}; 34*81ad6265SDimitry Andric template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_const<_Tp const> : public true_type {}; 35*81ad6265SDimitry Andric 36*81ad6265SDimitry Andric #if _LIBCPP_STD_VER > 14 37*81ad6265SDimitry Andric template <class _Tp> 38*81ad6265SDimitry Andric inline constexpr bool is_const_v = is_const<_Tp>::value; 39*81ad6265SDimitry Andric #endif 40*81ad6265SDimitry Andric 41*81ad6265SDimitry Andric #endif // __has_keyword(__is_const) 42*81ad6265SDimitry Andric 43*81ad6265SDimitry Andric _LIBCPP_END_NAMESPACE_STD 44*81ad6265SDimitry Andric 45*81ad6265SDimitry Andric #endif // _LIBCPP___TYPE_TRAITS_IS_CONST_H 46