[istream.iterator.cons]

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

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

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

#### 24.6.2.2 Constructors and destructor [istream.iterator.cons]

[ð](#lib:istream_iterator,constructor)

`constexpr istream_iterator();
constexpr istream_iterator(default_sentinel_t);
`

[1](#1)

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

*Effects*: Constructs the end-of-stream iterator, value-initializing value[.](#1.sentence-1)

[2](#2)

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

*Postconditions*: in_stream == nullptr is true[.](#2.sentence-1)

[3](#3)

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

*Remarks*: If the initializer T() in the declaration auto x = T(); is a constant initializer ([[expr.const]](expr.const "7.7 Constant expressions")),
then these constructors are constexpr constructors[.](#3.sentence-1)

[ð](#lib:istream_iterator,constructor_)

`istream_iterator(istream_type& s);
`

[4](#4)

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

*Effects*: Initializes in_stream with addressof(s),
value-initializes value,
and then calls operator++()[.](#4.sentence-1)

[ð](#lib:istream_iterator,constructor__)

`constexpr istream_iterator(const istream_iterator& x) noexcept(see below);
`

[5](#5)

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

*Effects*: Initializes in_stream with x.in_stream and
initializes value with x.value[.](#5.sentence-1)

[6](#6)

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

*Remarks*: An invocation of this constructor may be used in a core constant expression
if and only if the initialization of value from x.value is a constant subexpression ([[defns.const.subexpr]](defns.const.subexpr "3.15 constant subexpression"))[.](#6.sentence-1)

The exception specification is equivalent tois_nothrow_copy_constructible_v<T>[.](#6.sentence-2)

[ð](#lib:istream_iterator,destructor)

`~istream_iterator() = default;
`

[7](#7)

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

*Remarks*: If is_trivially_destructible_v<T> is true,
then this destructor is trivial[.](#7.sentence-1)
