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

Side by Side Diff: cc/base/scoped_ptr_vector.h

Issue 632613002: [C++11 Allowed Features] Declares a type-safe null pointer converting from NULL to nullptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « cc/base/math_util.cc ('k') | cc/base/scoped_ptr_vector_unittest.cc » ('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 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_BASE_SCOPED_PTR_VECTOR_H_ 5 #ifndef CC_BASE_SCOPED_PTR_VECTOR_H_
6 #define CC_BASE_SCOPED_PTR_VECTOR_H_ 6 #define CC_BASE_SCOPED_PTR_VECTOR_H_
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 return data_.empty(); 70 return data_.empty();
71 } 71 }
72 72
73 scoped_ptr<T> take(iterator position) { 73 scoped_ptr<T> take(iterator position) {
74 if (position == end()) 74 if (position == end())
75 return nullptr; 75 return nullptr;
76 DCHECK(position < end()); 76 DCHECK(position < end());
77 77
78 typename std::vector<T*>::iterator writable_position = position; 78 typename std::vector<T*>::iterator writable_position = position;
79 scoped_ptr<T> ret(*writable_position); 79 scoped_ptr<T> ret(*writable_position);
80 *writable_position = NULL; 80 *writable_position = nullptr;
81 return ret.Pass(); 81 return ret.Pass();
82 } 82 }
83 83
84 scoped_ptr<T> take_back() { 84 scoped_ptr<T> take_back() {
85 DCHECK(!empty()); 85 DCHECK(!empty());
86 if (empty()) 86 if (empty())
87 return nullptr; 87 return nullptr;
88 return take(end() - 1); 88 return take(end() - 1);
89 } 89 }
90 90
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 191
192 private: 192 private:
193 std::vector<T*> data_; 193 std::vector<T*> data_;
194 194
195 DISALLOW_COPY_AND_ASSIGN(ScopedPtrVector); 195 DISALLOW_COPY_AND_ASSIGN(ScopedPtrVector);
196 }; 196 };
197 197
198 } // namespace cc 198 } // namespace cc
199 199
200 #endif // CC_BASE_SCOPED_PTR_VECTOR_H_ 200 #endif // CC_BASE_SCOPED_PTR_VECTOR_H_
OLDNEW
« no previous file with comments | « cc/base/math_util.cc ('k') | cc/base/scoped_ptr_vector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698