Modernize use of std::make_unique
[folly.git] / folly / test / ThreadCachedIntTest.cpp
index 6b438f74fec1af2103a996c2846b34d51cf8433a..40b3f443cb67fdf7f33f855dd068c992f31c619a 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <atomic>
 #include <condition_variable>
+#include <memory>
 #include <thread>
 
 #include <glog/logging.h>
@@ -86,7 +87,8 @@ TEST_F(ThreadCachedIntTest, MultithreadedSlow) {
   // iteration, threads[1] performs 2 iterations, threads[2] performs
   // 3 iterations, and so on.
   for (uint32_t i = 0; i < kNumThreads; ++i) {
-    threads[i].reset(new std::thread(Runner, &g_counter_for_mt_slow, i + 1));
+    threads[i] =
+        std::make_unique<std::thread>(Runner, &g_counter_for_mt_slow, i + 1);
   }
   // Variable to grab current counter value.
   int32_t counter_value;
@@ -141,7 +143,8 @@ TEST_F(ThreadCachedIntTest, MultithreadedFast) {
   // iteration, threads[1] performs 2 iterations, threads[2] performs
   // 3 iterations, and so on.
   for (uint32_t i = 0; i < kNumThreads; ++i) {
-    threads[i].reset(new std::thread(Runner, &g_counter_for_mt_fast, i + 1));
+    threads[i] =
+        std::make_unique<std::thread>(Runner, &g_counter_for_mt_fast, i + 1);
   }
   // Let the threads run to completion.
   {