Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Side by Side Diff: cc/scoped_ptr_vector.h

Issue 11469034: Expose vector::swap on ScopedPtrVector. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_SCOPED_PTR_VECTOR_H_ 5 #ifndef CC_SCOPED_PTR_VECTOR_H_
6 #define CC_SCOPED_PTR_VECTOR_H_ 6 #define CC_SCOPED_PTR_VECTOR_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 void append(scoped_ptr<T> item) { 78 void append(scoped_ptr<T> item) {
79 data_.push_back(item.release()); 79 data_.push_back(item.release());
80 } 80 }
81 81
82 void insert(size_t index, scoped_ptr<T> item) { 82 void insert(size_t index, scoped_ptr<T> item) {
83 DCHECK(index < size()); 83 DCHECK(index < size());
84 data_.insert(data_.begin() + index, item.release()); 84 data_.insert(data_.begin() + index, item.release());
85 } 85 }
86 86
87 void swap(ScopedPtrVector<T>& other) {
88 data_.swap(other.data_);
89 }
90
87 iterator begin() { return data_.begin(); } 91 iterator begin() { return data_.begin(); }
88 const_iterator begin() const { return data_.begin(); } 92 const_iterator begin() const { return data_.begin(); }
89 iterator end() { return data_.end(); } 93 iterator end() { return data_.end(); }
90 const_iterator end() const { return data_.end(); } 94 const_iterator end() const { return data_.end(); }
91 95
92 reverse_iterator rbegin() { return data_.rbegin(); } 96 reverse_iterator rbegin() { return data_.rbegin(); }
93 const_reverse_iterator rbegin() const { return data_.rbegin(); } 97 const_reverse_iterator rbegin() const { return data_.rbegin(); }
94 reverse_iterator rend() { return data_.rend(); } 98 reverse_iterator rend() { return data_.rend(); }
95 const_reverse_iterator rend() const { return data_.rend(); } 99 const_reverse_iterator rend() const { return data_.rend(); }
96 100
97 private: 101 private:
98 std::vector<T*> data_; 102 std::vector<T*> data_;
99 103
100 DISALLOW_COPY_AND_ASSIGN(ScopedPtrVector); 104 DISALLOW_COPY_AND_ASSIGN(ScopedPtrVector);
101 }; 105 };
102 106
103 } // namespace cc 107 } // namespace cc
104 108
105 #endif // CC_SCOPED_PTR_VECTOR_H_ 109 #endif // CC_SCOPED_PTR_VECTOR_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698