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_SCOPED_ENUM_H 10 #define _LIBCPP___TYPE_TRAITS_IS_SCOPED_ENUM_H 11 12 #include <__config> 13 #include <__type_traits/integral_constant.h> 14 #include <__type_traits/is_convertible.h> 15 #include <__type_traits/is_enum.h> 16 #include <__type_traits/underlying_type.h> 17 18 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 19 # pragma GCC system_header 20 #endif 21 22 _LIBCPP_BEGIN_NAMESPACE_STD 23 24 #if _LIBCPP_STD_VER > 20 25 template <class _Tp, bool = is_enum_v<_Tp> > 26 struct __is_scoped_enum_helper : false_type {}; 27 28 template <class _Tp> 29 struct __is_scoped_enum_helper<_Tp, true> 30 : public bool_constant<!is_convertible_v<_Tp, underlying_type_t<_Tp> > > {}; 31 32 template <class _Tp> 33 struct _LIBCPP_TEMPLATE_VIS is_scoped_enum 34 : public __is_scoped_enum_helper<_Tp> {}; 35 36 template <class _Tp> 37 inline constexpr bool is_scoped_enum_v = is_scoped_enum<_Tp>::value; 38 #endif 39 40 _LIBCPP_END_NAMESPACE_STD 41 42 #endif // _LIBCPP___TYPE_TRAITS_IS_SCOPED_ENUM_H 43