1 //===-- invoke_result 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_INVOKE_RESULT_H 9 #define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_INVOKE_RESULT_H 10 11 #include "src/__support/CPP/type_traits/invoke.h" 12 #include "src/__support/CPP/type_traits/type_identity.h" 13 #include "src/__support/CPP/utility/declval.h" 14 #include "src/__support/macros/config.h" 15 16 namespace LIBC_NAMESPACE_DECL { 17 namespace cpp { 18 19 template <class F, class... Args> 20 struct invoke_result : cpp::type_identity<decltype(cpp::invoke( 21 cpp::declval<F>(), cpp::declval<Args>()...))> {}; 22 23 template <class F, class... Args> 24 using invoke_result_t = typename invoke_result<F, Args...>::type; 25 26 } // namespace cpp 27 } // namespace LIBC_NAMESPACE_DECL 28 29 #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_INVOKE_RESULT_H 30