From dd00fd8134ac7bdf72117a23e143094474e142cd Mon Sep 17 00:00:00 2001
From: Hans Fugal <fugalh@fb.com>
Date: Wed, 29 Apr 2015 09:46:26 -0700
Subject: [PATCH] Move this `reduce` to `helpers.h`

Summary: just a lowly non-erroring semantic merge conflict

Test Plan: builds

Reviewed By: jsedgwick@fb.com

Subscribers: trunkagent, exa, folly-diffs@, jsedgwick, yfeldblum, chalfant

FB internal diff: D2029593

Signature: t1:2029593:1430319785:2cd96927b9080fe18b168ab95ad201afc4f00857
---
 folly/futures/Future.h  | 11 -----------
 folly/futures/helpers.h | 19 +++++++++++++++----
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/folly/futures/Future.h b/folly/futures/Future.h
index 0989873d..3111fbf9 100644
--- a/folly/futures/Future.h
+++ b/folly/futures/Future.h
@@ -404,17 +404,6 @@ class Future {
 };
 
 
-// Sugar for the most common case
-template <class Collection, class T, class F>
-auto reduce(Collection&& c, T&& initial, F&& func)
-    -> decltype(reduce(c.begin(), c.end(), initial, func)) {
-  return reduce(
-      c.begin(),
-      c.end(),
-      std::forward<T>(initial),
-      std::forward<F>(func));
-}
-
 } // folly
 
 #include <folly/futures/Future-inl.h>
diff --git a/folly/futures/helpers.h b/folly/futures/helpers.h
index 138cfd47..7fd79508 100644
--- a/folly/futures/helpers.h
+++ b/folly/futures/helpers.h
@@ -153,7 +153,7 @@ Future<std::vector<Try<
   typename std::iterator_traits<InputIterator>::value_type::value_type>>>
 collectAll(InputIterator first, InputIterator last);
 
-// Sugar for the most common case
+/// Sugar for the most common case
 template <class Collection>
 auto collectAll(Collection&& c) -> decltype(collectAll(c.begin(), c.end())) {
   return collectAll(c.begin(), c.end());
@@ -177,7 +177,7 @@ Future<typename detail::CollectContext<
 >::result_type>
 collect(InputIterator first, InputIterator last);
 
-// Sugar for the most common case
+/// Sugar for the most common case
 template <class Collection>
 auto collect(Collection&& c) -> decltype(collect(c.begin(), c.end())) {
   return collect(c.begin(), c.end());
@@ -195,7 +195,7 @@ Future<std::pair<
   Try<typename std::iterator_traits<InputIterator>::value_type::value_type>>>
 collectAny(InputIterator first, InputIterator last);
 
-// Sugar for the most common case
+/// Sugar for the most common case
 template <class Collection>
 auto collectAny(Collection&& c) -> decltype(collectAny(c.begin(), c.end())) {
   return collectAny(c.begin(), c.end());
@@ -213,7 +213,7 @@ Future<std::vector<std::pair<
   Try<typename std::iterator_traits<InputIterator>::value_type::value_type>>>>
 collectN(InputIterator first, InputIterator last, size_t n);
 
-// Sugar for the most common case
+/// Sugar for the most common case
 template <class Collection>
 auto collectN(Collection&& c, size_t n)
     -> decltype(collectN(c.begin(), c.end(), n)) {
@@ -246,4 +246,15 @@ template <class It, class T, class F,
 typename std::enable_if<isFutureResult<F, T, Arg>::value, Future<T>>::type
 reduce(It first, It last, T initial, F func);
 
+/// Sugar for the most common case
+template <class Collection, class T, class F>
+auto reduce(Collection&& c, T&& initial, F&& func)
+    -> decltype(reduce(c.begin(), c.end(), initial, func)) {
+  return reduce(
+      c.begin(),
+      c.end(),
+      std::forward<T>(initial),
+      std::forward<F>(func));
+}
+
 } // namespace folly
-- 
2.34.1