forked from managarm/cxxshim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathiterator
More file actions
42 lines (34 loc) · 757 Bytes
/
iterator
File metadata and controls
42 lines (34 loc) · 757 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef _CXXSHIM_ITERATOR
#define _CXXSHIM_ITERATOR
namespace std {
template<class Container>
class back_insert_iterator {
public:
explicit back_insert_iterator(Container &c) : _c(&c) { }
back_insert_iterator operator*() {
// no-op
return *this;
}
back_insert_iterator operator++() {
// no-op
return *this;
}
back_insert_iterator operator++(int val) {
// no-op
(void) val;
return *this;
}
back_insert_iterator &operator=(const typename Container::value_type
&value) {
_c->push_back(value);
return *this;
}
protected:
Container *_c;
};
template<class Container>
back_insert_iterator<Container> back_inserter(Container &c) {
return back_insert_iterator<Container>(c);
}
} // namespace std
#endif // _CXXSHIM_ITERATOR