xref: /llvm-project/libc/src/__support/CPP/type_traits/is_union.h (revision 5ff3ff33ff930e4ec49da7910612d8a41eb068cb)
1 //===-- is_union 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_UNION_H
9 #define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_UNION_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_union
19 template <class T> struct is_union : bool_constant<__is_union(T)> {};
20 template <typename T>
21 LIBC_INLINE_VAR constexpr bool is_union_v = is_union<T>::value;
22 
23 } // namespace cpp
24 } // namespace LIBC_NAMESPACE_DECL
25 
26 #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_UNION_H
27