Commit 2e7e90e4 authored by Max Katsev's avatar Max Katsev Committed by Facebook Github Bot

alias folly::apply to std::apply on C++17

Summary: Previously this code failed to build due to ambiguity between folly::apply and std::apply

Reviewed By: aary, ot, luciang

Differential Revision: D8705541

fbshipit-source-id: 575c52517792a930d3639b39eba4abc352739d6f
parent 9dfd1bda
...@@ -66,12 +66,20 @@ struct ApplyInvoke : private detail::apply_tuple::adl::ApplyInvoke { ...@@ -66,12 +66,20 @@ struct ApplyInvoke : private detail::apply_tuple::adl::ApplyInvoke {
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
#if __cpp_lib_apply >= 201603
/* using override */ using std::apply;
#else // __cpp_lib_apply >= 201603
// mimic: std::apply, C++17 // mimic: std::apply, C++17
template <typename F, typename Tuple> template <typename F, typename Tuple>
constexpr decltype(auto) apply(F&& func, Tuple&& tuple) { constexpr decltype(auto) apply(F&& func, Tuple&& tuple) {
return ApplyInvoke{}(static_cast<F&&>(func), static_cast<Tuple&&>(tuple)); return ApplyInvoke{}(static_cast<F&&>(func), static_cast<Tuple&&>(tuple));
} }
#endif // __cpp_lib_apply >= 201603
/** /**
* Mimic the invoke suite of traits for tuple based apply invocation * Mimic the invoke suite of traits for tuple based apply invocation
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment