[istream.iterator.general]

# 24 Iterators library [[iterators]](./#iterators)

## 24.6 Stream iterators [[stream.iterators]](stream.iterators#istream.iterator.general)

### 24.6.2 Class template istream_iterator [[istream.iterator]](istream.iterator#general)

#### 24.6.2.1 General [istream.iterator.general]

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L6505)

The class template istream_iterator is an input iterator ([[input.iterators]](input.iterators "24.3.5.3 Input iterators")) that reads successive elements
from the input stream for which it was constructed[.](#1.sentence-1)

namespace std {template<class T, class charT = char, class traits = char_traits<charT>, class Distance = ptrdiff_t>class istream_iterator {public:using iterator_category = input_iterator_tag; using value_type = T; using difference_type = Distance; using pointer = const T*; using reference = const T&; using char_type = charT; using traits_type = traits; using istream_type = basic_istream<charT,traits>; constexpr istream_iterator(); constexpr istream_iterator(default_sentinel_t);
 istream_iterator(istream_type& s); constexpr istream_iterator(const istream_iterator& x) noexcept(*see below*); ~istream_iterator() = default;
 istream_iterator& operator=(const istream_iterator&) = default; const T& operator*() const; const T* operator->() const;
 istream_iterator& operator++();
 istream_iterator operator++(int); friend bool operator==(const istream_iterator& i, default_sentinel_t); private: basic_istream<charT,traits>* in_stream; // *exposition only* T value; // *exposition only*};}

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L6547)

The type T shall meet the *Cpp17DefaultConstructible*,*Cpp17CopyConstructible*, and *Cpp17CopyAssignable* requirements[.](#2.sentence-1)
