diff --git a/folly/experimental/fibers/AddTasks-inl.h b/folly/experimental/fibers/AddTasks-inl.h index 1e74f63..783a987 100644 --- a/folly/experimental/fibers/AddTasks-inl.h +++ b/folly/experimental/fibers/AddTasks-inl.h @@ -115,7 +115,7 @@ addTasks(InputIterator first, InputIterator last) { #endif addTask( [i, context, f = std::move(*first)]() { - context->results.emplace_back(i, folly::makeTryFunction(std::move(f))); + context->results.emplace_back(i, folly::makeTryWith(std::move(f))); // Check for awaiting iterator. if (context->promise.hasValue()) { diff --git a/folly/experimental/fibers/FiberManager-inl.h b/folly/experimental/fibers/FiberManager-inl.h index 512d59e..97df9ca 100644 --- a/folly/experimental/fibers/FiberManager-inl.h +++ b/folly/experimental/fibers/FiberManager-inl.h @@ -309,7 +309,7 @@ struct FiberManager::AddTaskFinallyHelper { func_(std::move(func)), result_(finally.result_) {} void operator()() { - result_ = folly::makeTryFunction(std::move(func_)); + result_ = folly::makeTryWith(std::move(func_)); if (allocateInBuffer) { this->~Func(); @@ -387,7 +387,7 @@ FiberManager::runInMainContextHelper(F&& func) { folly::Try result; auto f = [&func, &result]() mutable { - result = folly::makeTryFunction(std::forward(func)); + result = folly::makeTryWith(std::forward(func)); }; immediateFunc_ = std::ref(f); diff --git a/folly/experimental/fibers/Promise-inl.h b/folly/experimental/fibers/Promise-inl.h index b7e92b5..a3a4927 100644 --- a/folly/experimental/fibers/Promise-inl.h +++ b/folly/experimental/fibers/Promise-inl.h @@ -87,7 +87,7 @@ void Promise::setValue() { template template void Promise::setWith(F&& func) { - setTry(makeTryFunction(std::forward(func))); + setTry(makeTryWith(std::forward(func))); } }} diff --git a/folly/futures/Promise-inl.h b/folly/futures/Promise-inl.h index b855d06..7019b72 100644 --- a/folly/futures/Promise-inl.h +++ b/folly/futures/Promise-inl.h @@ -127,7 +127,7 @@ template template void Promise::setWith(F&& func) { throwIfFulfilled(); - setTry(makeTryFunction(std::forward(func))); + setTry(makeTryWith(std::forward(func))); } } diff --git a/folly/futures/Try-inl.h b/folly/futures/Try-inl.h index 1928731..22bc877 100644 --- a/folly/futures/Try-inl.h +++ b/folly/futures/Try-inl.h @@ -128,7 +128,7 @@ template typename std::enable_if< !std::is_same::type, void>::value, Try::type>>::type -makeTryFunction(F&& f) { +makeTryWith(F&& f) { typedef typename std::result_of::type ResultType; try { return Try(f()); @@ -143,7 +143,7 @@ template typename std::enable_if< std::is_same::type, void>::value, Try>::type -makeTryFunction(F&& f) { +makeTryWith(F&& f) { try { f(); return Try(); diff --git a/folly/futures/Try.h b/folly/futures/Try.h index 9e791dc..5f5f634 100644 --- a/folly/futures/Try.h +++ b/folly/futures/Try.h @@ -361,10 +361,10 @@ template typename std::enable_if< !std::is_same::type, void>::value, Try::type>>::type -makeTryFunction(F&& f); +makeTryWith(F&& f); /* - * Specialization of makeTryFunction for void + * Specialization of makeTryWith for void * * @param f a function to execute and capture the result of * @@ -374,7 +374,7 @@ template typename std::enable_if< std::is_same::type, void>::value, Try>::type -makeTryFunction(F&& f); +makeTryWith(F&& f); } // folly diff --git a/folly/futures/test/Try.cpp b/folly/futures/test/Try.cpp index 69a3e0d..f0bb5d6 100644 --- a/folly/futures/test/Try.cpp +++ b/folly/futures/test/Try.cpp @@ -34,41 +34,41 @@ TEST(Try, moveOnly) { v.reserve(10); } -TEST(Try, makeTryFunction) { +TEST(Try, makeTryWith) { auto func = []() { return folly::make_unique(1); }; - auto result = makeTryFunction(func); + auto result = makeTryWith(func); EXPECT_TRUE(result.hasValue()); EXPECT_EQ(*result.value(), 1); } -TEST(Try, makeTryFunctionThrow) { +TEST(Try, makeTryWithThrow) { auto func = []() { throw std::runtime_error("Runtime"); return folly::make_unique(1); }; - auto result = makeTryFunction(func); + auto result = makeTryWith(func); EXPECT_TRUE(result.hasException()); } -TEST(Try, makeTryFunctionVoid) { +TEST(Try, makeTryWithVoid) { auto func = []() { return; }; - auto result = makeTryFunction(func); + auto result = makeTryWith(func); EXPECT_TRUE(result.hasValue()); } -TEST(Try, makeTryFunctionVoidThrow) { +TEST(Try, makeTryWithVoidThrow) { auto func = []() { throw std::runtime_error("Runtime"); return; }; - auto result = makeTryFunction(func); + auto result = makeTryWith(func); EXPECT_TRUE(result.hasException()); }