beautypg.com

HP Integrity NonStop H-Series User Manual

Page 33

background image

values from a vector into the standard output, and separates each value by a space:

copy (newdata.begin(), newdata.end(),
ostream_iterator (cout, " "));

Simple file transformation algorithms can be created by combining input and output stream
iterators and the various algorithms provided by the standard library. The following short
program reads a file of integers from the standard input, removes all occurrences of the value 7,
and copies the remainder to the standard output, separating each value by a new line:

void main()
{
istream_iterator input (cin), eof;
ostream_iterator output (cout, "\n");

remove_copy (input, eof, output, 7);
}

This manual is related to the following products: