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

Side by Side Diff: base/memory/scoped_vector.h

Issue 11078014: Fix move.h's to use a concrete RValue carrier object rather than hacking a RValue&. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix error. Created 8 years, 2 months 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 | « base/memory/scoped_ptr.h ('k') | base/move.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 BASE_MEMORY_SCOPED_VECTOR_H_ 5 #ifndef BASE_MEMORY_SCOPED_VECTOR_H_
6 #define BASE_MEMORY_SCOPED_VECTOR_H_ 6 #define BASE_MEMORY_SCOPED_VECTOR_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 16 matching lines...) Expand all
27 typedef typename std::vector<T*>::const_reference const_reference; 27 typedef typename std::vector<T*>::const_reference const_reference;
28 typedef typename std::vector<T*>::value_type value_type; 28 typedef typename std::vector<T*>::value_type value_type;
29 typedef typename std::vector<T*>::iterator iterator; 29 typedef typename std::vector<T*>::iterator iterator;
30 typedef typename std::vector<T*>::const_iterator const_iterator; 30 typedef typename std::vector<T*>::const_iterator const_iterator;
31 typedef typename std::vector<T*>::reverse_iterator reverse_iterator; 31 typedef typename std::vector<T*>::reverse_iterator reverse_iterator;
32 typedef typename std::vector<T*>::const_reverse_iterator 32 typedef typename std::vector<T*>::const_reverse_iterator
33 const_reverse_iterator; 33 const_reverse_iterator;
34 34
35 ScopedVector() {} 35 ScopedVector() {}
36 ~ScopedVector() { clear(); } 36 ~ScopedVector() { clear(); }
37 ScopedVector(RValue& other) { swap(other); } 37 ScopedVector(RValue other) { swap(*other.object); }
38 38
39 ScopedVector& operator=(RValue& rhs) { 39 ScopedVector& operator=(RValue rhs) {
40 swap(rhs); 40 swap(*rhs.object);
41 return *this; 41 return *this;
42 } 42 }
43 43
44 T*& operator[](size_t index) { return v_[index]; } 44 T*& operator[](size_t index) { return v_[index]; }
45 const T* operator[](size_t index) const { return v_[index]; } 45 const T* operator[](size_t index) const { return v_[index]; }
46 46
47 bool empty() const { return v_.empty(); } 47 bool empty() const { return v_.empty(); }
48 size_t size() const { return v_.size(); } 48 size_t size() const { return v_.size(); }
49 49
50 reverse_iterator rbegin() { return v_.rbegin(); } 50 reverse_iterator rbegin() { return v_.rbegin(); }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // Like |erase()|, but doesn't delete the elements in [first, last). 115 // Like |erase()|, but doesn't delete the elements in [first, last).
116 iterator weak_erase(iterator first, iterator last) { 116 iterator weak_erase(iterator first, iterator last) {
117 return v_.erase(first, last); 117 return v_.erase(first, last);
118 } 118 }
119 119
120 private: 120 private:
121 std::vector<T*> v_; 121 std::vector<T*> v_;
122 }; 122 };
123 123
124 #endif // BASE_MEMORY_SCOPED_VECTOR_H_ 124 #endif // BASE_MEMORY_SCOPED_VECTOR_H_
OLDNEW
« no previous file with comments | « base/memory/scoped_ptr.h ('k') | base/move.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698