共用方式為


ostream_iterator Class

The template class ostream_iterator describes an output iterator object that writes successive elements onto the output stream with the extraction operator <<.

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

template <
   class Type 
   class CharType = char
   class Traits = char_traits<CharType>
>
class ostream_iterator

Parameters

  • Type
    The type of object to be inserted into the output stream.

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

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

The ostream_iterator class must satisfy the requirements for an output iterator. Algorithms can be written directly to output streams using an ostream_iterator.

Requirements

Header: <iterator>

Namespace: std

See Also

Reference

Thread Safety in the Standard C++ Library

Standard Template Library

Other Resources

ostream_iterator Members

<iterator> Members