37939a2e29a6b39239f271125426a16b8c09a02d
[platform/framework/web/crosswalk.git] / src / third_party / libc++ / trunk / test / strings / basic.string / input_iterator.h
1 #ifndef INPUT_ITERATOR_H
2 #define INPUT_ITERATOR_H
3
4 #include <iterator>
5
6 template <class It>
7 class input_iterator
8 {
9     It it_;
10 public:
11     typedef typename std::input_iterator_tag                   iterator_category;
12     typedef typename std::iterator_traits<It>::value_type      value_type;
13     typedef typename std::iterator_traits<It>::difference_type difference_type;
14     typedef It                                                 pointer;
15     typedef typename std::iterator_traits<It>::reference       reference;
16
17     input_iterator() : it_() {}
18     explicit input_iterator(It it) : it_(it) {}
19
20     reference operator*() const {return *it_;}
21     pointer operator->() const {return it_;}
22
23     input_iterator& operator++() {++it_; return *this;}
24     input_iterator operator++(int) {input_iterator tmp(*this); ++(*this); return tmp;}
25
26     friend bool operator==(const input_iterator& x, const input_iterator& y)
27         {return x.it_ == y.it_;}
28     friend bool operator!=(const input_iterator& x, const input_iterator& y)
29         {return !(x == y);}
30 };
31
32 #endif  // INPUT_ITERATOR_H