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

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

Issue 10544185: Order the script badges in the location bar consistently (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: . Created 8 years, 6 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
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 // Scopers help you manage ownership of a pointer, helping you easily manage the 5 // Scopers help you manage ownership of a pointer, helping you easily manage the
6 // a pointer within a scope, and automatically destroying the pointer at the 6 // a pointer within a scope, and automatically destroying the pointer at the
7 // end of a scope. There are two main classes you will use, which correspond 7 // end of a scope. There are two main classes you will use, which correspond
8 // to the operators new/delete and new[]/delete[]. 8 // to the operators new/delete and new[]/delete[].
9 // 9 //
10 // Example usage (scoped_ptr): 10 // Example usage (scoped_ptr):
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 template<class C, class FP> inline 486 template<class C, class FP> inline
487 bool operator==(C* p, const scoped_ptr_malloc<C, FP>& b) { 487 bool operator==(C* p, const scoped_ptr_malloc<C, FP>& b) {
488 return p == b.get(); 488 return p == b.get();
489 } 489 }
490 490
491 template<class C, class FP> inline 491 template<class C, class FP> inline
492 bool operator!=(C* p, const scoped_ptr_malloc<C, FP>& b) { 492 bool operator!=(C* p, const scoped_ptr_malloc<C, FP>& b) {
493 return p != b.get(); 493 return p != b.get();
494 } 494 }
495 495
496 template <typename T>
497 scoped_ptr<T> make_scoped_ptr() {
willchan no longer on Chromium 2012/06/15 23:15:01 Can't we change this to take T*?
Jeffrey Yasskin 2012/06/15 23:17:38 This could use a comment like // Use this as: //
willchan no longer on Chromium 2012/06/18 03:16:53 My initial inclination was to reject this, because
Jeffrey Yasskin 2012/06/18 05:42:15 Interestingly, make_scoped_refptr doesn't take own
not at google - send to devlin 2012/06/18 17:50:27 I think that... consistency with make_linked_ptr w
willchan no longer on Chromium 2012/06/18 18:52:32 I don't think it'll go away (did I say that? if so
498 return scoped_ptr<T>(new T());
499 }
500
501 template <typename T, typename A1>
502 scoped_ptr<T> make_scoped_ptr(const A1& a1) {
503 return scoped_ptr<T>(new T(a1));
504 }
505
506 template <typename T, typename A1, typename A2>
507 scoped_ptr<T> make_scoped_ptr(const A1& a1, const A2& a2) {
508 return scoped_ptr<T>(new T(a1, a2));
509 }
510
511 template <typename T, typename A1, typename A2, typename A3>
512 scoped_ptr<T> make_scoped_ptr(const A1& a1, const A2& a2, const A3& a3) {
513 return scoped_ptr<T>(new T(a1, a2, a3));
514 }
515
496 #endif // BASE_MEMORY_SCOPED_PTR_H_ 516 #endif // BASE_MEMORY_SCOPED_PTR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698