xref: /llvm-project/libc/src/__support/CPP/type_traits/is_enum.h (revision 5ff3ff33ff930e4ec49da7910612d8a41eb068cb)
1 //===-- is_enum type_traits -------------------------------------*- C++ -*-===//
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 #ifndef LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_ENUM_H
9 #define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_ENUM_H
10 
11 #include "src/__support/CPP/type_traits/bool_constant.h"
12 #include "src/__support/macros/attributes.h"
13 #include "src/__support/macros/config.h"
14 
15 namespace LIBC_NAMESPACE_DECL {
16 namespace cpp {
17 
18 // is_enum
19 template <typename T> struct is_enum : bool_constant<__is_enum(T)> {};
20 template <typename T>
21 LIBC_INLINE_VAR constexpr bool is_enum_v = is_enum<T>::value;
22 
23 } // namespace cpp
24 } // namespace LIBC_NAMESPACE_DECL
25 
26 #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_ENUM_H
27