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 #include "src/__support/macros/config.h" 13 14 namespace LIBC_NAMESPACE_DECL { 15 namespace cpp { 16 17 // enable_if 18 template <bool B, typename T = void> struct enable_if; 19 template <typename T> struct enable_if<true, T> : type_identity<T> {}; 20 template <bool B, typename T = void> 21 using enable_if_t = typename enable_if<B, T>::type; 22 23 } // namespace cpp 24 } // namespace LIBC_NAMESPACE_DECL 25 26 #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ENABLE_IF_H 27