Dela via


ostream_iterator::traits_type

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

typedef Traits traits_type;

Remarks

The type is a synonym for the template parameter Traits.

Example

// ostream_iterator_traits_type.cpp
// compile with: /EHsc
#include <iterator>
#include <vector>
#include <iostream>

int main( )
{
   using namespace std;

   // The following not OK, but are just the default values:
   typedef ostream_iterator<int>::char_type CHT1;
   typedef ostream_iterator<int>::traits_type CHTR1;

   // ostream_iterator for stream cout
   // with new line delimiter:
    ostream_iterator<int, CHT1, CHTR1> intOut ( cout , "\n" );

   // Standard iterator interface for writing
   // elements to the output stream:
   cout << "The integers written to output stream\n"
        << "by intOut are:" << endl;
   *intOut = 1;
   *intOut = 10;
   *intOut = 100;
}
The integers written to output stream
by intOut are:
1
10
100

Requirements

Header: <iterator>

Namespace: std

See Also

Reference

ostream_iterator Class

Standard Template Library

Other Resources

ostream_iterator Members