---
name: "std::istream_iterator"
section: "3cxx"
platform: "linux"
package: "libstdc++-12-doc"
version: "12.4.0-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/std::istream_iterator/3cxx"
---

# std::istream\_iterator(3cxx)

Provides input iterator semantics for streams.

## NAME

std::istream\_iterator\< \_Tp, \_CharT, \_Traits, \_Dist \> - Provides input iterator semantics for streams.

## SYNOPSIS

`#include <iterator>`

Inherits **std::iterator\< \_Category, \_Tp, \_Distance, \_Pointer, \_Reference \>**.

### Public Types

**typedef** \_CharT **char\_type**\
 **typedef** **\_Distance** **difference\_type**\
 Distance between iterators is represented as this type.  **typedef** **basic\_istream**\< \_CharT, \_Traits \> **istream\_type**\
 **typedef** **\_Category** **iterator\_category**\
 One of the **tag types**.  **typedef** \_Pointer **pointer**\
 This type represents a pointer-to-value\_type.  **typedef** \_Reference **reference**\
 This type represents a reference-to-value\_type.  **typedef** \_Traits **traits\_type**\
 **typedef** \_Tp **value\_type**\
 The type 'pointed to' by the iterator.

### Public Member Functions

constexpr **istream\_iterator** () noexcept(/\***conditional** \*/)\
 Construct end of input stream iterator.  constexpr **istream\_iterator** (const **istream\_iterator** &**\_\_obj**) noexcept(/\***conditional** \*/)\
 **istream\_iterator** (**istream\_type** &**\_\_s**)\
 Construct start of input stream iterator.  const \_Tp & **operator\*** () const noexcept\
 **istream\_iterator** & **operator++** ()\
 **istream\_iterator** **operator++** (int)\
 const \_Tp \* **operator-\>** () const noexcept\
 **istream\_iterator** & **operator=** (const **istream\_iterator** &)=**default**\

### Friends

bool **operator==** (const **istream\_iterator** &\_\_x, const **istream\_iterator** &\_\_y) noexcept\
 Return true if the iterators refer to the same stream, or are both at end-of-stream.

## Detailed Description

### template\<typename \_Tp, typename \_CharT = char, typename \_Traits = char\_traits\<\_CharT\>, typename \_Dist = ptrdiff\_t\>

class std::istream\_iterator\< \_Tp, \_CharT, \_Traits, \_Dist \>"Provides input iterator semantics for streams.

## Member Typedef Documentation

### template\<typename \_Category , typename \_Tp , typename \_Distance = ptrdiff\_t, typename \_Pointer = \_Tp\*, typename \_Reference = \_Tp&\> typedef \_Distance std::iterator\< \_Category, \_Tp, \_Distance, \_Pointer, \_Reference \>::difference\_type` [inherited]`

Distance between iterators is represented as this type.

### template\<typename \_Category , typename \_Tp , typename \_Distance = ptrdiff\_t, typename \_Pointer = \_Tp\*, typename \_Reference = \_Tp&\> typedef \_Category std::iterator\< \_Category, \_Tp, \_Distance, \_Pointer, \_Reference \>::iterator\_category` [inherited]`

One of the **tag types**.

### template\<typename \_Category , typename \_Tp , typename \_Distance = ptrdiff\_t, typename \_Pointer = \_Tp\*, typename \_Reference = \_Tp&\> typedef \_Pointer std::iterator\< \_Category, \_Tp, \_Distance, \_Pointer, \_Reference \>::pointer` [inherited]`

This type represents a pointer-to-value\_type.

### template\<typename \_Category , typename \_Tp , typename \_Distance = ptrdiff\_t, typename \_Pointer = \_Tp\*, typename \_Reference = \_Tp&\> typedef \_Reference std::iterator\< \_Category, \_Tp, \_Distance, \_Pointer, \_Reference \>::reference` [inherited]`

This type represents a reference-to-value\_type.

### template\<typename \_Category , typename \_Tp , typename \_Distance = ptrdiff\_t, typename \_Pointer = \_Tp\*, typename \_Reference = \_Tp&\> typedef \_Tp std::iterator\< \_Category, \_Tp, \_Distance, \_Pointer, \_Reference \>::value\_type` [inherited]`

The type 'pointed to' by the iterator.

## Constructor & Destructor Documentation

### template\<typename \_Tp , typename \_CharT = char, typename \_Traits = char\_traits\<\_CharT\>, typename \_Dist = ptrdiff\_t\> constexpr std::istream\_iterator\< \_Tp, \_CharT, \_Traits, \_Dist \>::istream\_iterator ()` [inline]`, ` [constexpr]`, ` [noexcept]`

Construct end of input stream iterator.

### template\<typename \_Tp , typename \_CharT = char, typename \_Traits = char\_traits\<\_CharT\>, typename \_Dist = ptrdiff\_t\> std::istream\_iterator\< \_Tp, \_CharT, \_Traits, \_Dist \>::istream\_iterator (istream\_type & \_\_s)` [inline]`

Construct start of input stream iterator.

## Friends And Related Symbol Documentation

### template\<typename \_Tp , typename \_CharT = char, typename \_Traits = char\_traits\<\_CharT\>, typename \_Dist = ptrdiff\_t\> bool operator== (const istream\_iterator\< \_Tp, \_CharT, \_Traits, \_Dist \> & \_\_x, const istream\_iterator\< \_Tp, \_CharT, \_Traits, \_Dist \> & \_\_y)` [friend]`

Return true if the iterators refer to the same stream, or are both at end-of-stream.

## Author

Generated automatically by Doxygen for libstdc++ from the source code.
