deprecating boost::shared_ptr
authorLouis Brandy <ldbrandy@fb.com>
Fri, 16 Aug 2013 22:19:09 +0000 (15:19 -0700)
committerJordan DeLong <jdelong@fb.com>
Sun, 22 Sep 2013 23:40:58 +0000 (16:40 -0700)
Summary:
Replacing boost::shared_ptr with std::shared_ptr.

Test Plan: .

Reviewed By: andrei.alexandrescu@fb.com

FB internal diff: D932119

folly/ConcurrentSkipList.h
folly/test/ConcurrentSkipListBenchmark.cpp
folly/test/ConcurrentSkipListTest.cpp

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