Modernize uses of std::make_shared
authorChristopher Dykes <cdykes@fb.com>
Mon, 23 Oct 2017 23:52:19 +0000 (16:52 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Mon, 23 Oct 2017 23:57:17 +0000 (16:57 -0700)
Summary: Via the modernize-make-shared from clang-tidy

Reviewed By: yfeldblum

Differential Revision: D6129464

fbshipit-source-id: 04f560c6beeb2b8631b819fd4e6a2d51b37eeb4b

folly/io/async/test/AsyncSocketTest.h
folly/test/ConcurrentSkipListBenchmark.cpp

index 95f302e47deb57f46835ee3c5d346195d0190e2f..f8c03f8818a9cce9082fa33412119aa11fa822a4 100644 (file)
@@ -20,6 +20,7 @@
 #include <folly/portability/Sockets.h>
 
 #include <boost/scoped_array.hpp>
+#include <memory>
 
 enum StateEnum {
   STATE_WAITING,
@@ -370,7 +371,7 @@ class TestServer {
 
   std::shared_ptr<BlockingSocket> accept(int timeout=50) {
     int fd = acceptFD(timeout);
-    return std::shared_ptr<BlockingSocket>(new BlockingSocket(fd));
+    return std::make_shared<BlockingSocket>(fd);
   }
 
   std::shared_ptr<folly::AsyncSocket> acceptAsync(folly::EventBase* evb,
index 09b9d17b446a38d82a55d103a148be1339e48923..020a7bf78701b93b34a0c151f20af94e49b5c46e 100644 (file)
@@ -17,6 +17,7 @@
 // @author: Xin Liu <xliux@fb.com>
 
 #include <map>
+#include <memory>
 #include <random>
 #include <set>
 #include <thread>
@@ -485,8 +486,7 @@ static std::map<int, std::shared_ptr<ConcurrentAccessData> > g_data;
 static ConcurrentAccessData *mayInitTestData(int size) {
   auto it = g_data.find(size);
   if (it == g_data.end()) {
-    auto ptr = std::shared_ptr<ConcurrentAccessData>(
-        new ConcurrentAccessData(size));
+    auto ptr = std::make_shared<ConcurrentAccessData>(size);
     g_data[size] = ptr;
     return ptr.get();
   }