Commit 0b29ff65 authored by Joe Loser's avatar Joe Loser Committed by Facebook GitHub Bot

Replace folly::make_unique with std::make_unique (#1572)

Summary:
Problem:
- Some call sites use `folly::make_unique` whose functionality exists in
  the standard library now. In the future, `folly::make_unique` may be
  removed.

Solution:
- Replace call sites to use `std::make_unique`.

Pull Request resolved: https://github.com/facebook/folly/pull/1572

Differential Revision: D28235226

Pulled By: yfeldblum

fbshipit-source-id: 2dd85f4d234881d682adaf4b5bbe947f56edaa4e
parent e2ca17cb
...@@ -112,7 +112,7 @@ class AtomicCoreCachedSharedPtr { ...@@ -112,7 +112,7 @@ class AtomicCoreCachedSharedPtr {
} }
void reset(const std::shared_ptr<T>& p = nullptr) { void reset(const std::shared_ptr<T>& p = nullptr) {
auto newslots = folly::make_unique<Slots>(); auto newslots = std::make_unique<Slots>();
// Allocate each Holder in a different CoreRawAllocator stripe to // Allocate each Holder in a different CoreRawAllocator stripe to
// prevent false sharing. Their control blocks will be adjacent // prevent false sharing. Their control blocks will be adjacent
// thanks to allocate_shared(). // thanks to allocate_shared().
......
...@@ -17,10 +17,10 @@ ...@@ -17,10 +17,10 @@
#include <folly/memory/UninitializedMemoryHacks.h> #include <folly/memory/UninitializedMemoryHacks.h>
#include <algorithm> #include <algorithm>
#include <memory>
#include <string> #include <string>
#include <vector> #include <vector>
#include <folly/Memory.h>
#include <folly/Random.h> #include <folly/Random.h>
#include <folly/portability/GTest.h> #include <folly/portability/GTest.h>
...@@ -215,7 +215,7 @@ template <typename T> ...@@ -215,7 +215,7 @@ template <typename T>
void testRandom(size_t numSteps = 10000) { void testRandom(size_t numSteps = 10000) {
describePlatform(); describePlatform();
auto target = folly::make_unique<T>(); auto target = std::make_unique<T>();
std::vector<bool> valid; std::vector<bool> valid;
for (size_t step = 0; step < numSteps; ++step) { for (size_t step = 0; step < numSteps; ++step) {
...@@ -239,9 +239,9 @@ void testRandom(size_t numSteps = 10000) { ...@@ -239,9 +239,9 @@ void testRandom(size_t numSteps = 10000) {
} else if (pct < 20) { } else if (pct < 20) {
*target = copy; *target = copy;
} else if (pct < 25) { } else if (pct < 25) {
target = folly::make_unique<T>(std::move(copy)); target = std::make_unique<T>(std::move(copy));
} else { } else {
target = folly::make_unique<T>(copy); target = std::make_unique<T>(copy);
} }
} else if (pct < 35) { } else if (pct < 35) {
target->reserve(v); target->reserve(v);
...@@ -258,7 +258,7 @@ void testRandom(size_t numSteps = 10000) { ...@@ -258,7 +258,7 @@ void testRandom(size_t numSteps = 10000) {
} else if (pct < 60) { } else if (pct < 60) {
doPushBack(*target, valid); doPushBack(*target, valid);
} else if (pct < 65) { } else if (pct < 65) {
target = folly::make_unique<T>(); target = std::make_unique<T>();
valid.clear(); valid.clear();
} else if (pct < 80) { } else if (pct < 80) {
auto v2 = folly::Random::rand32(uint32_t{3} << folly::Random::rand32(14)); auto v2 = folly::Random::rand32(uint32_t{3} << folly::Random::rand32(14));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment