Commit a88ef0be authored by Louis Brandy's avatar Louis Brandy Committed by Jordan DeLong

deprecating boost::shared_ptr

Summary:
Replacing boost::shared_ptr with std::shared_ptr.

Test Plan: .

Reviewed By: andrei.alexandrescu@fb.com

FB internal diff: D932119
parent 253f44cb
...@@ -129,7 +129,7 @@ Sample usage: ...@@ -129,7 +129,7 @@ Sample usage:
#include <thread> #include <thread>
#include <boost/iterator/iterator_facade.hpp> #include <boost/iterator/iterator_facade.hpp>
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp> #include <memory>
#include <glog/logging.h> #include <glog/logging.h>
#include "folly/ConcurrentSkipList-inl.h" #include "folly/ConcurrentSkipList-inl.h"
...@@ -166,8 +166,8 @@ class ConcurrentSkipList { ...@@ -166,8 +166,8 @@ class ConcurrentSkipList {
} }
// create a shared_ptr skiplist object with initial head height. // create a shared_ptr skiplist object with initial head height.
static boost::shared_ptr<SkipListType> createInstance(int height=1) { static std::shared_ptr<SkipListType> createInstance(int height=1) {
return boost::shared_ptr<SkipListType>(new SkipListType(height)); return std::shared_ptr<SkipListType>(new SkipListType(height));
} }
// create a unique_ptr skiplist object with initial head height. // create a unique_ptr skiplist object with initial head height.
...@@ -593,7 +593,7 @@ class ConcurrentSkipList<T, Comp, MAX_HEIGHT>::Accessor { ...@@ -593,7 +593,7 @@ class ConcurrentSkipList<T, Comp, MAX_HEIGHT>::Accessor {
typedef typename SkipListType::const_iterator const_iterator; typedef typename SkipListType::const_iterator const_iterator;
typedef typename SkipListType::Skipper Skipper; typedef typename SkipListType::Skipper Skipper;
explicit Accessor(boost::shared_ptr<ConcurrentSkipList> skip_list) explicit Accessor(std::shared_ptr<ConcurrentSkipList> skip_list)
: slHolder_(std::move(skip_list)) : slHolder_(std::move(skip_list))
{ {
sl_ = slHolder_.get(); sl_ = slHolder_.get();
...@@ -704,7 +704,7 @@ class ConcurrentSkipList<T, Comp, MAX_HEIGHT>::Accessor { ...@@ -704,7 +704,7 @@ class ConcurrentSkipList<T, Comp, MAX_HEIGHT>::Accessor {
private: private:
SkipListType *sl_; SkipListType *sl_;
boost::shared_ptr<SkipListType> slHolder_; std::shared_ptr<SkipListType> slHolder_;
}; };
// implements forward iterator concept. // implements forward iterator concept.
...@@ -756,7 +756,7 @@ class ConcurrentSkipList<T, Comp, MAX_HEIGHT>::Skipper { ...@@ -756,7 +756,7 @@ class ConcurrentSkipList<T, Comp, MAX_HEIGHT>::Skipper {
typedef T* pointer; typedef T* pointer;
typedef ptrdiff_t difference_type; typedef ptrdiff_t difference_type;
Skipper(const boost::shared_ptr<SkipListType>& skipList) : Skipper(const std::shared_ptr<SkipListType>& skipList) :
accessor_(skipList) { accessor_(skipList) {
init(); init();
} }
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#include <set> #include <set>
#include <thread> #include <thread>
#include <boost/shared_ptr.hpp>
#include <gflags/gflags.h> #include <gflags/gflags.h>
#include <glog/logging.h> #include <glog/logging.h>
#include "folly/Benchmark.h" #include "folly/Benchmark.h"
...@@ -468,12 +466,12 @@ class ConcurrentAccessData { ...@@ -468,12 +466,12 @@ class ConcurrentAccessData {
std::vector<ValueType> deleteValues_; std::vector<ValueType> deleteValues_;
}; };
static std::map<int, boost::shared_ptr<ConcurrentAccessData> > g_data; static std::map<int, std::shared_ptr<ConcurrentAccessData> > g_data;
static ConcurrentAccessData *mayInitTestData(int size) { static ConcurrentAccessData *mayInitTestData(int size) {
auto it = g_data.find(size); auto it = g_data.find(size);
if (it == g_data.end()) { if (it == g_data.end()) {
auto ptr = boost::shared_ptr<ConcurrentAccessData>( auto ptr = std::shared_ptr<ConcurrentAccessData>(
new ConcurrentAccessData(size)); new ConcurrentAccessData(size));
g_data[size] = ptr; g_data[size] = ptr;
return ptr.get(); return ptr.get();
......
...@@ -218,7 +218,7 @@ static std::string makeRandomeString(int len) { ...@@ -218,7 +218,7 @@ static std::string makeRandomeString(int len) {
TEST(ConcurrentSkipList, TestStringType) { TEST(ConcurrentSkipList, TestStringType) {
typedef folly::ConcurrentSkipList<std::string> SkipListT; typedef folly::ConcurrentSkipList<std::string> SkipListT;
boost::shared_ptr<SkipListT> skip = SkipListT::createInstance(); std::shared_ptr<SkipListT> skip = SkipListT::createInstance();
SkipListT::Accessor accessor(skip); SkipListT::Accessor accessor(skip);
{ {
for (int i = 0; i < 100000; i++) { for (int i = 0; i < 100000; i++) {
......
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