| Index: sandbox/linux/bpf_dsl/cons.h
|
| diff --git a/sandbox/linux/bpf_dsl/cons.h b/sandbox/linux/bpf_dsl/cons.h
|
| index be050f77817eef4bd4f7a4b228a00a6c789b7fef..07ac3dfc23d3855b322fb937382d71bbc17832d4 100644
|
| --- a/sandbox/linux/bpf_dsl/cons.h
|
| +++ b/sandbox/linux/bpf_dsl/cons.h
|
| @@ -5,8 +5,9 @@
|
| #ifndef SANDBOX_LINUX_BPF_DSL_CONS_H_
|
| #define SANDBOX_LINUX_BPF_DSL_CONS_H_
|
|
|
| +#include <memory>
|
| +
|
| #include "base/macros.h"
|
| -#include "base/memory/ref_counted.h"
|
| #include "sandbox/sandbox_export.h"
|
|
|
| namespace sandbox {
|
| @@ -60,19 +61,19 @@ class ListIterator;
|
|
|
| // List represents a (possibly null) pointer to a cons cell.
|
| template <typename T>
|
| -using List = scoped_refptr<const Cell<T>>;
|
| +using List = std::shared_ptr<const Cell<T>>;
|
|
|
| // Cons extends a cons list by prepending a new value to the front.
|
| template <typename T>
|
| -List<T> Cons(const T& head, const List<T>& tail) {
|
| - return List<T>(new const Cell<T>(head, tail));
|
| +List<T> Cons(const T& head, List<T> tail) {
|
| + return std::make_shared<Cell<T>>(head, std::move(tail));
|
| }
|
|
|
| // Cell represents an individual "cons cell" within a cons list.
|
| template <typename T>
|
| -class Cell : public base::RefCounted<Cell<T>> {
|
| +class Cell {
|
| public:
|
| - Cell(const T& head, const List<T>& tail) : head_(head), tail_(tail) {}
|
| + Cell(const T& head, List<T> tail) : head_(head), tail_(std::move(tail)) {}
|
|
|
| // Head returns this cell's head element.
|
| const T& head() const { return head_; }
|
| @@ -81,12 +82,9 @@ class Cell : public base::RefCounted<Cell<T>> {
|
| const List<T>& tail() const { return tail_; }
|
|
|
| private:
|
| - virtual ~Cell() {}
|
| -
|
| T head_;
|
| List<T> tail_;
|
|
|
| - friend class base::RefCounted<Cell<T>>;
|
| DISALLOW_COPY_AND_ASSIGN(Cell);
|
| };
|
|
|
|
|