Require -std=c++11 and use std::shared_ptr instead of SharedHandle

This commit is contained in:
Tatsuhiro Tsujikawa 2013-06-22 01:10:38 +09:00
parent 126a4bde61
commit 07d270c87e
709 changed files with 6305 additions and 6878 deletions

View file

@ -38,23 +38,22 @@
#include "common.h"
#include <deque>
#include "SharedHandle.h"
#include <memory>
namespace aria2 {
template<typename T>
class SequentialPicker {
private:
std::deque<SharedHandle<T> > entries_;
SharedHandle<T> pickedEntry_;
std::deque<std::shared_ptr<T> > entries_;
std::shared_ptr<T> pickedEntry_;
public:
bool isPicked() const
{
return pickedEntry_;
return pickedEntry_.get();
}
const SharedHandle<T>& getPickedEntry() const
const std::shared_ptr<T>& getPickedEntry() const
{
return pickedEntry_;
}
@ -69,9 +68,9 @@ public:
return !entries_.empty();
}
SharedHandle<T> pickNext()
std::shared_ptr<T> pickNext()
{
SharedHandle<T> r;
std::shared_ptr<T> r;
if(hasNext()) {
r = entries_.front();
entries_.pop_front();
@ -80,7 +79,7 @@ public:
return r;
}
void pushEntry(const SharedHandle<T>& entry)
void pushEntry(const std::shared_ptr<T>& entry)
{
entries_.push_back(entry);
}