1 | //===-- enable_if 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_ENABLE_IF_H |
9 | #define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ENABLE_IF_H |
10 | |
11 | #include "src/__support/CPP/type_traits/type_identity.h" |
12 | |
13 | namespace LIBC_NAMESPACE::cpp { |
14 | |
15 | // enable_if |
16 | template <bool B, typename T = void> struct enable_if; |
17 | template <typename T> struct enable_if<true, T> : type_identity<T> {}; |
18 | template <bool B, typename T = void> |
19 | using enable_if_t = typename enable_if<B, T>::type; |
20 | |
21 | } // namespace LIBC_NAMESPACE::cpp |
22 | |
23 | #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ENABLE_IF_H |
24 | |