---
name: "std::istreambuf_iterator"
section: "3"
platform: "linux"
package: "gcc"
version: "16.2.1+r23+gd564253eb6c8-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/std::istreambuf_iterator"
---

# std::istreambuf\_iterator(3)

Provides input iterator semantics for streambufs.

## NAME

std::istreambuf\_iterator\< \_CharT, \_Traits \> - Provides input iterator semantics for streambufs.

## SYNOPSIS

\#include \<iterator\>

Inherits **std::iterator\< input\_iterator\_tag, \_CharT, \_Traits::off\_type, \_CharT \*, \_CharT \>**.

### Public Types

typedef \_Traits::off\_type **difference\_type**\
 Distance between iterators is represented as this type.  typedef **input\_iterator\_tag** **iterator\_category**\
 One of the **tag types**.  typedef \_CharT **reference**\
 This type represents a reference-to-value\_type.  typedef \_CharT **value\_type**\
 The type *pointed*to"*by*the*iterator.*

using **pointer**\
 Public typedefs.  typedef \_CharT **char\_type**\
 Public typedefs.  typedef \_Traits **traits\_type**\
 Public typedefs.  typedef \_Traits::int\_type **int\_type**\
 Public typedefs.  typedef **basic\_streambuf**\< \_CharT, \_Traits \> **streambuf\_type**\
 Public typedefs.  typedef **basic\_istream**\< \_CharT, \_Traits \> **istream\_type**\
 Public typedefs.

### Public Member Functions

constexpr **istreambuf\_iterator** () noexcept\
 Construct end of input stream iterator.  **istreambuf\_iterator** (const istreambuf\_iterator &) noexcept=default\
 constexpr **istreambuf\_iterator** (**default\_sentinel\_t**) noexcept\
 **istreambuf\_iterator** (**istream\_type** &\_\_s) noexcept\
 Construct start of input stream iterator.  **istreambuf\_iterator** (**streambuf\_type** \*\_\_s) noexcept\
 Construct start of streambuf iterator.  bool **equal** (const **istreambuf\_iterator** &\_\_b) const\
 Return true both iterators are end or both are not end.  **char\_type** **operator\*** () const\
 Return the current character pointed to by iterator. This returns streambuf.sgetc(). It cannot be assigned. NB: The result of operator\*() on an end of stream is undefined.  **istreambuf\_iterator** & **operator++** ()\
 Advance the iterator. Calls streambuf.sbumpc().  **istreambuf\_iterator** **operator++** (int)\
 Advance the iterator. Calls streambuf.sbumpc().  **istreambuf\_iterator** & **operator=** (const **istreambuf\_iterator** &) noexcept=default\

### Friends

template\<bool \_IsMove, typename \_CharT2\> \_\_gnu\_cxx::\_\_enable\_if\< \_\_is\_char\< \_CharT2 \>::\_\_value, \_CharT2 \* \>::\_\_type **\_\_copy\_move\_a2** (**istreambuf\_iterator**\< \_CharT2 \>, **istreambuf\_iterator**\< \_CharT2 \>, \_CharT2 \*)\
 template\<typename \_CharT2, typename \_Size\> \_\_gnu\_cxx::\_\_enable\_if\< \_\_is\_char\< \_CharT2 \>::\_\_value, \_CharT2 \* \>::\_\_type **\_\_copy\_n\_a** (**istreambuf\_iterator**\< \_CharT2 \>, \_Size, \_CharT2 \*, bool)\
 template\<typename \_CharT2, typename \_Distance\> \_\_gnu\_cxx::\_\_enable\_if\< \_\_is\_char\< \_CharT2 \>::\_\_value, void \>::\_\_type **advance** (**istreambuf\_iterator**\< \_CharT2 \> &, \_Distance)\
 template\<typename \_CharT2\> \_\_gnu\_cxx::\_\_enable\_if\< \_\_is\_char\< \_CharT2 \>::\_\_value, **ostreambuf\_iterator**\< \_CharT2 \> \>::\_\_type **copy** (**istreambuf\_iterator**\< \_CharT2 \>, **istreambuf\_iterator**\< \_CharT2 \>, **ostreambuf\_iterator**\< \_CharT2 \>)\
 template\<typename \_CharT2\> \_\_gnu\_cxx::\_\_enable\_if\< \_\_is\_char\< \_CharT2 \>::\_\_value, **istreambuf\_iterator**\< \_CharT2 \> \>::\_\_type **find** (**istreambuf\_iterator**\< \_CharT2 \>, **istreambuf\_iterator**\< \_CharT2 \>, const \_CharT2 &)\
 bool **operator==** (const **istreambuf\_iterator** &\_\_i, **default\_sentinel\_t**)\

## Detailed Description

### template\<typename \_CharT, typename \_Traits\>

class std::istreambuf\_iterator\< \_CharT, \_Traits \>"Provides input iterator semantics for streambufs.

## Member Typedef Documentation

### template\<typename \_CharT, typename \_Traits\> typedef \_CharT std::istreambuf\_iterator\< \_CharT, \_Traits \>::char\_type

Public typedefs.

### typedef \_Traits::off\_type std::iterator\< input\_iterator\_tag, \_CharT, \_Traits::off\_type, \_CharT \*, \_CharT \>::difference\_type \[inherited\]

Distance between iterators is represented as this type.

### template\<typename \_CharT, typename \_Traits\> typedef \_Traits::int\_type std::istreambuf\_iterator\< \_CharT, \_Traits \>::int\_type

Public typedefs.

### template\<typename \_CharT, typename \_Traits\> typedef basic\_istream\<\_CharT, \_Traits\> std::istreambuf\_iterator\< \_CharT, \_Traits \>::istream\_type

Public typedefs.

### typedef input\_iterator\_tag std::iterator\< input\_iterator\_tag, \_CharT, \_Traits::off\_type, \_CharT \*, \_CharT \>::iterator\_category \[inherited\]

One of the **tag types**.

### template\<typename \_CharT, typename \_Traits\> using std::istreambuf\_iterator\< \_CharT, \_Traits \>::pointer

Public typedefs.

### typedef \_CharT std::iterator\< input\_iterator\_tag, \_CharT, \_Traits::off\_type, \_CharT \*, \_CharT \>::reference \[inherited\]

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

### template\<typename \_CharT, typename \_Traits\> typedef basic\_streambuf\<\_CharT, \_Traits\> std::istreambuf\_iterator\< \_CharT, \_Traits \>::streambuf\_type

Public typedefs.

### template\<typename \_CharT, typename \_Traits\> typedef \_Traits std::istreambuf\_iterator\< \_CharT, \_Traits \>::traits\_type

Public typedefs.

### typedef \_CharT std::iterator\< input\_iterator\_tag, \_CharT, \_Traits::off\_type, \_CharT \*, \_CharT \>::value\_type \[inherited\]

The type "pointed to" by the iterator.

## Constructor & Destructor Documentation

### template\<typename \_CharT, typename \_Traits\> std::istreambuf\_iterator\< \_CharT, \_Traits \>::istreambuf\_iterator () \[inline\], \[constexpr\], \[noexcept\]

Construct end of input stream iterator.

Referenced by **equal()**, and **operator++()**.

### template\<typename \_CharT, typename \_Traits\> std::istreambuf\_iterator\< \_CharT, \_Traits \>::istreambuf\_iterator (istream\_type & \_\_s) \[inline\], \[noexcept\]

Construct start of input stream iterator.

### template\<typename \_CharT, typename \_Traits\> std::istreambuf\_iterator\< \_CharT, \_Traits \>::istreambuf\_iterator (streambuf\_type \* \_\_s) \[inline\], \[noexcept\]

Construct start of streambuf iterator.

## Member Function Documentation

### template\<typename \_CharT, typename \_Traits\> bool std::istreambuf\_iterator\< \_CharT, \_Traits \>::equal (const istreambuf\_iterator\< \_CharT, \_Traits \> & \_\_b) const \[inline\], \[nodiscard\]

Return true both iterators are end or both are not end.

References **istreambuf\_iterator()**.

### template\<typename \_CharT, typename \_Traits\> char\_type std::istreambuf\_iterator\< \_CharT, \_Traits \>::operator\* () const \[inline\], \[nodiscard\]

Return the current character pointed to by iterator. This returns streambuf.sgetc(). It cannot be assigned. NB: The result of operator\*() on an end of stream is undefined.

### template\<typename \_CharT, typename \_Traits\> istreambuf\_iterator & std::istreambuf\_iterator\< \_CharT, \_Traits \>::operator++ () \[inline\]

Advance the iterator. Calls streambuf.sbumpc().

### template\<typename \_CharT, typename \_Traits\> istreambuf\_iterator std::istreambuf\_iterator\< \_CharT, \_Traits \>::operator++ (int ) \[inline\]

Advance the iterator. Calls streambuf.sbumpc().

References **istreambuf\_iterator()**.

## Author

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