OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "base/memory/scoped_ptr.h" | |
Nico
2013/06/11 19:58:13
Hm. One day, someone will move scoped_ptr to names
dcheng
2013/06/11 20:07:41
Originally, that's what I did--I just had a minima
| |
6 | |
7 void TestDeclarations() { | |
8 scoped_ptr<int> a, b(new int), c; | |
9 scoped_ptr_malloc<int> d; | |
10 } | |
11 | |
12 void TestNew() { | |
13 scoped_ptr<int>* a = new scoped_ptr<int>, *b = new scoped_ptr<int>(new int), | |
14 *c = new scoped_ptr<int>; | |
15 } | |
16 | |
17 class TestInitializers { | |
18 public: | |
19 TestInitializers() {} | |
20 TestInitializers(bool) {} | |
21 TestInitializers(double) : b(new int), c() {} | |
22 | |
23 private: | |
24 scoped_ptr<int> a; | |
25 scoped_ptr<int> b; | |
26 scoped_ptr<int> c; | |
27 }; | |
28 | |
29 scoped_ptr<int> TestTemporaries(scoped_ptr<int> a, scoped_ptr<int> b) { | |
30 scoped_ptr<int> c = | |
31 TestTemporaries(scoped_ptr<int>(), scoped_ptr<int>(new int)); | |
32 return scoped_ptr<int>(); | |
33 } | |
OLD | NEW |