Expose move result from LockFreeRingBuffer::Cursor
[folly.git] / folly / test / ForeachTest.cpp
index bff6b502452ea61ca0776774d0ed887431b1b1ec..4d97b0b0ddfdbd1509ab03b3ef3f76f20286429a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014 Facebook, Inc.
+ * Copyright 2015 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -188,8 +188,6 @@ BENCHMARK(ForEachKVNoMacroAssign, iters) {
 
   BENCHMARK_SUSPEND {
     setupBenchmark(iters);
-    int sumKeys = 0;
-    std::string sumValues = "";
   }
 
   FOR_EACH (iter, bmMap) {
@@ -215,11 +213,12 @@ BENCHMARK(ForEachKVNoMacroNoAssign, iters) {
 }
 
 BENCHMARK(ManualLoopNoAssign, iters) {
+  int sumKeys = 0;
+  std::string sumValues;
+
   BENCHMARK_SUSPEND {
     setupBenchmark(iters);
   }
-  int sumKeys = 0;
-  std::string sumValues;
 
   for (auto iter = bmMap.begin(); iter != bmMap.end(); ++iter) {
     sumKeys += iter->first;
@@ -228,11 +227,12 @@ BENCHMARK(ManualLoopNoAssign, iters) {
 }
 
 BENCHMARK(ForEachKVMacro, iters) {
+  int sumKeys = 0;
+  std::string sumValues;
+
   BENCHMARK_SUSPEND {
     setupBenchmark(iters);
   }
-  int sumKeys = 0;
-  std::string sumValues;
 
   FOR_EACH_KV (k, v, bmMap) {
     sumKeys += k;
@@ -266,7 +266,7 @@ BENCHMARK(ForEachDescendingManual, iters) {
 
 BENCHMARK(ForEachRangeR, iters) {
   int sum = 1;
-  FOR_EACH_RANGE_R (i, 1, iters) {
+  FOR_EACH_RANGE_R (i, 1U, iters) {
     sum *= i;
   }
   doNotOptimizeAway(sum);