From 374d408bcd0283dffd5b0bec78685bc17e567c43 Mon Sep 17 00:00:00 2001 From: Aaryaman Sagar Date: Thu, 24 Aug 2017 14:42:53 -0700 Subject: [PATCH] unwrapTryTuple only accepted rvalue tuple types Summary: unwrapTryTuple only accepted rvalue tuple types, this diff fixes that to work with forwarding reference tuple types. Also reduces the number of template instantiations Reviewed By: yfeldblum Differential Revision: D5682996 fbshipit-source-id: ee6dd2c20d8dfca33e769a98a6ca56fa96c73b72 --- folly/Makefile.am | 1 - folly/Try-inl.h | 33 +++++++++++++++++++++++----- folly/Try.h | 10 +++++++-- folly/detail/TryDetail.h | 46 ---------------------------------------- folly/test/TryTest.cpp | 21 ++++++++++++++++++ 5 files changed, 57 insertions(+), 54 deletions(-) delete mode 100644 folly/detail/TryDetail.h diff --git a/folly/Makefile.am b/folly/Makefile.am index d2ed843e..18aa5bd4 100644 --- a/folly/Makefile.am +++ b/folly/Makefile.am @@ -82,7 +82,6 @@ nobase_follyinclude_HEADERS = \ detail/SocketFastOpen.h \ detail/StaticSingletonManager.h \ detail/ThreadLocalDetail.h \ - detail/TryDetail.h \ detail/TurnSequencer.h \ detail/UncaughtExceptionCounter.h \ Demangle.h \ diff --git a/folly/Try-inl.h b/folly/Try-inl.h index 8adeb423..e70fce72 100644 --- a/folly/Try-inl.h +++ b/folly/Try-inl.h @@ -16,8 +16,10 @@ #pragma once -#include +#include + #include +#include namespace folly { @@ -163,10 +165,31 @@ makeTryWith(F&& f) { } } -template -std::tuple unwrapTryTuple(std::tuple...>&& ts) { - return detail::TryTuple::unwrap( - std::forward...>>(ts)); +namespace try_detail { + +/** + * Trait that removes the layer of Try abstractions from the passed in type + */ +template +struct RemoveTry; +template