[PowerPC][NFC] Cleanup PPCCTRLoopsVerify pass
[llvm-project.git] / libcxx / test / std / strings / basic.string / input_iterator.h
blob131be9fadd3732e6b0ad68663726ef270d67b6ea
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef INPUT_ITERATOR_H
10 #define INPUT_ITERATOR_H
12 #include <iterator>
14 template <class It>
15 class input_iterator
17 It it_;
18 public:
19 typedef typename std::input_iterator_tag iterator_category;
20 typedef typename std::iterator_traits<It>::value_type value_type;
21 typedef typename std::iterator_traits<It>::difference_type difference_type;
22 typedef It pointer;
23 typedef typename std::iterator_traits<It>::reference reference;
25 input_iterator() : it_() {}
26 explicit input_iterator(It it) : it_(it) {}
28 reference operator*() const {return *it_;}
29 pointer operator->() const {return it_;}
31 input_iterator& operator++() {++it_; return *this;}
32 input_iterator operator++(int) {input_iterator tmp(*this); ++(*this); return tmp;}
34 friend bool operator==(const input_iterator& x, const input_iterator& y)
35 {return x.it_ == y.it_;}
36 friend bool operator!=(const input_iterator& x, const input_iterator& y)
37 {return !(x == y);}
40 #endif // INPUT_ITERATOR_H