Fix -Wshadow warning in sorted_vector_types
authorMichael Lee <mzlee@fb.com>
Sat, 25 Feb 2017 02:08:13 +0000 (18:08 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Sat, 25 Feb 2017 02:20:03 +0000 (18:20 -0800)
Summary: `last` was already passed in as a variable, so switch this so there isn't a local variable at all.

Reviewed By: mlogan, yfeldblum

Differential Revision: D4615206

fbshipit-source-id: dd8e3157e54dc2abe3dfd97837ce327371f4f7b2

folly/sorted_vector_types.h

index f70f79794548ec5f15ca4314458103975aae3598..fe586a861fb7c31c2138ef9fcd7b3e20b0c90abb 100644 (file)
@@ -171,14 +171,15 @@ namespace detail {
     }
     if (middle != cont.begin() && cmp(*middle, *(middle - 1))) {
       std::inplace_merge(cont.begin(), middle, cont.end(), cmp);
-      auto last = std::unique(
-          cont.begin(),
-          cont.end(),
-          [&](typename OurContainer::value_type const& a,
-              typename OurContainer::value_type const& b) {
-            return !cmp(a, b) && !cmp(b, a);
-          });
-      cont.erase(last, cont.end());
+      cont.erase(
+          std::unique(
+              cont.begin(),
+              cont.end(),
+              [&](typename OurContainer::value_type const& a,
+                  typename OurContainer::value_type const& b) {
+                return !cmp(a, b) && !cmp(b, a);
+              }),
+          cont.end());
     }
   }
 }