/*
- * Copyright 2012 Facebook, Inc.
+ * Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#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"
}
// 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.
//===================================================================
~ConcurrentSkipList() {
- LOG_IF(FATAL, recycler_.refs() > 0)
- << "number of accessors is not 0, " << recycler_.refs() << " instead!"
- << " This shouldn't have happened!";
+ CHECK_EQ(recycler_.refs(), 0);
while (NodeType* current = head_.load(std::memory_order_relaxed)) {
NodeType* tmp = current->skip(0);
NodeType::destroy(current);
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();
private:
SkipListType *sl_;
- boost::shared_ptr<SkipListType> slHolder_;
+ std::shared_ptr<SkipListType> slHolder_;
};
// implements forward iterator concept.
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();
}