ostream_iterator |
An iterator that outputs items (with an optional trailer) in a typesafe manner to an output stream.
#include <iostream>
#include <iterator>
#include <algorithm>
int array[] = { 1, 5, 2, 4 };
void
main()
{
char* string = "hello";
ostream_iterator< char > it1( cout );
copy( string, string + 5, it1 );
cout << "\n";
ostream_iterator< int > it2( cout );
copy( array, array + 4, it2 );
cout << "\n";
}
hello
1524
Copyright©1994-2026 Recursion Software LLC
All Rights Reserved - For use by licensed users only.