다음을 통해 공유


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>.

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 istreambuf_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.

Constructors

istreambuf_iterator

Constructs an istreambuf_iterator that is initialized to read characters from the input stream.

Typedefs

char_type

A type that provides for the character type of the ostreambuf_iterator.

int_type

A type that provides an integer type for an istreambuf_iterator.

istream_type

A type that provides for the stream type of the istream_iterator.

streambuf_type

A type that provides for the stream type of the istreambuf_iterator.

traits_type

A type that provides for the character traits type of the istream_iterator.

Member Functions

equal

Tests for equality between two input stream buffer iterators.

Operators

operator*

The dereferencing operator returns the next character in the stream.

operator++

Either returns the next character from the input stream or copies the object before incrementing it and returns the copy.

operator->

Returns the value of a member, if any.

Requirements

Header: <iterator>

Namespace: std

See Also

Reference

iterator Struct

<iterator>

Thread Safety in the C++ Standard Library

Standard Template Library