Condividi tramite


istream_iterator Class

Describes an input iterator object. It extracts objects of class Type from an input stream, which it accesses through an object it stores, of type pointer to basic_istream<CharType, Traits>.

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

template <
   class Type 
   class CharType = char
   class Traits = char_traits<CharType>
   class Distance= ptrdiff_t
>
class istream_iterator : 
public iterator<input_iterator_tag, Type, Distance, const Type *, const Type &>

Parameters

  • Type
    The type of object to be extracted from the input stream.

  • CharType
    The type that represents the character type for the istream_iterator. This argument is optional and the default value is char*.*

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

  • Distance
    A signed integral type that represents the difference type for the istream_iterator. This argument is optional and the default value is ptrdiff_t*.*

After constructing or incrementing an object of class istream_iterator with a nonnull stored pointer, the object attempts to extract and store an object of type Type from the associated input stream. 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

Reference

iterator Struct

Thread Safety in the Standard C++ Library

Standard Template Library

Other Resources

istream_iterator Members

<iterator> Members