Chromium Code Reviews| Index: cc/scoped_ptr_deque.h |
| diff --git a/cc/scoped_ptr_deque.h b/cc/scoped_ptr_deque.h |
| index 64f09a8a8ec11f2a6f66ea5f9df41017ef21296d..338d4d62845dc84e6bcea6c3b8d52dae67cc620f 100644 |
| --- a/cc/scoped_ptr_deque.h |
| +++ b/cc/scoped_ptr_deque.h |
| @@ -31,37 +31,37 @@ class ScopedPtrDeque { |
| return data_.size(); |
| } |
| - T* Peek(size_t index) const { |
| + T* at(size_t index) const { |
| DCHECK(index < size()); |
| return data_[index]; |
| } |
| T* operator[](size_t index) const { |
| - return Peek(index); |
| + return at(index); |
| } |
| - T* first() const { |
| - DCHECK(!isEmpty()); |
| - return Peek(0); |
| + T* front() const { |
| + DCHECK(!empty()); |
| + return at(0); |
| } |
| - T* last() const { |
| - DCHECK(!isEmpty()); |
| - return Peek(size() - 1); |
| + T* back() const { |
| + DCHECK(!empty()); |
| + return at(size() - 1); |
| } |
| - bool isEmpty() const { |
| + bool empty() const { |
| return size() == 0; |
| } |
| - scoped_ptr<T> takeFirst() { |
| - scoped_ptr<T> ret(first()); |
| + scoped_ptr<T> take_front() { |
|
enne (OOO)
2012/11/21 04:12:57
I know take is convenient, but it's also inconsist
danakj
2012/11/21 04:23:21
Oh, take_front is removing the element so it could
|
| + scoped_ptr<T> ret(front()); |
| data_.pop_front(); |
| return ret.Pass(); |
| } |
| - scoped_ptr<T> takeLast() { |
| - scoped_ptr<T> ret(last()); |
| + scoped_ptr<T> take_back() { |
| + scoped_ptr<T> ret(back()); |
| data_.pop_back(); |
| return ret.Pass(); |
| } |
| @@ -70,13 +70,16 @@ class ScopedPtrDeque { |
| STLDeleteElements(&data_); |
| } |
| - void append(scoped_ptr<T> item) { |
| + void push_front(scoped_ptr<T> item) { |
| + data_.push_front(item.release()); |
| + } |
| + |
| + void push_back(scoped_ptr<T> item) { |
| data_.push_back(item.release()); |
| } |
| - void insert(size_t index, scoped_ptr<T> item) { |
| - DCHECK(index < size()); |
| - data_.insert(data_.begin() + index, item.release()); |
| + void insert(iterator position, scoped_ptr<T> item) { |
| + data_.insert(position, item.release()); |
| } |
| iterator begin() { return data_.begin(); } |