1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef INPUT_ITERATOR_H
10 #define INPUT_ITERATOR_H
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
;
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
)
40 #endif // INPUT_ITERATOR_H