Partager via


istreambuf_iterator Class

The template class istreambuf_iterator describes an input iterator object that extracts character elements from an input stream buffer, which it accesses through an object it stores, of type pointer to basic_streambuf<CharType, Traits>.

For a list of all members of this type, see istreambuf_iterator Members.

template < 
      class CharType
   class Traits = char_traits<CharType>
>
class istreambuf_iterator
: public iterator<input_iterator_tag, CharType, typename Traits::off_type, CharType *, CharType&>

Parameters

  • CharType
    The type that represents the character type for the istreambuf_iterator.

  • Traits
    The type that represents the character type for the istreambuf_iterator. This argument is optional and the default value is char_traits<CharType>.

Remarks

The ostreambuf_iterator class must satisfy the requirements for an input iterator.

After constructing or incrementing an object of class istreambuf_iterator with a non-null stored pointer, the object effectively attempts to extract and store an object of type CharType from the associated input stream. The extraction may be delayed, however, until the object is actually dereferenced or copied. If the extraction fails, the object effectively replaces the stored pointer with a null pointer, thus making an end-of-sequence indicator.

Requirements

Header: <iterator>

Namespace: std

See Also

Concepts

istreambuf_iterator Members

iterator Struct

<iterator> Members

Thread Safety in the Standard C++ Library

Standard Template Library