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

Side by Side Diff: tools/clang/rewrite_scoped_refptr/tests/test12-original.cc

Issue 1385193002: Bisect clang Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 246985 Created 5 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
OLDNEW
(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 <iterator>
6 #include <map>
7 #include <string>
8
9 #include "scoped_refptr.h"
10
11 struct Foo {
12 int dummy;
13 };
14
15 typedef std::map<std::string, scoped_refptr<const Foo> > MyMap;
16
17 class MyIter
18 : public std::iterator<std::input_iterator_tag, scoped_refptr<const Foo> > {
19 public:
20 MyIter() {}
21 MyIter(const MyIter& other) : it_(other.it_) {}
22 explicit MyIter(MyMap::const_iterator it) : it_(it) {}
23 MyIter& operator++() {
24 ++it_;
25 return *this;
26 }
27 const scoped_refptr<const Foo> operator*() { return it_->second; }
28 bool operator!=(const MyIter& other) { return it_ != other.it_; }
29 bool operator==(const MyIter& other) { return it_ == other.it_; }
30
31 private:
32 MyMap::const_iterator it_;
33 };
34
35 void TestsAScopedRefptr() {
36 MyMap map;
37 map["foo"] = new Foo;
38 map["bar"] = new Foo;
39 MyIter my_begin(map.begin());
40 MyIter my_end(map.end());
41 for (MyIter it = my_begin; it != my_end; ++it) {
42 const Foo* item = NULL;
43 if (*it)
44 item = *it;
45 }
46 }
OLDNEW
« no previous file with comments | « tools/clang/rewrite_scoped_refptr/tests/test12-expected.cc ('k') | tools/clang/rewrite_scoped_refptr/tests/test3-expected.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698