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 >= 23
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> : public bool_constant<!is_convertible_v<_Tp, underlying_type_t<_Tp> > > {};
30 
31 template <class _Tp>
32 struct _LIBCPP_TEMPLATE_VIS is_scoped_enum : public __is_scoped_enum_helper<_Tp> {};
33 
34 template <class _Tp>
35 inline constexpr bool is_scoped_enum_v = is_scoped_enum<_Tp>::value;
36 #endif
37 
38 _LIBCPP_END_NAMESPACE_STD
39 
40 #endif // _LIBCPP___TYPE_TRAITS_IS_SCOPED_ENUM_H
41