// This file is part of a series that illustrates the ostream_iterator // and insert_iterator template classes. // // This code uses insert_iterator to populate the set with the values // from the integer array. Of course, it would be easier to use set's // two-iterator constructor, but this illustrates insert_iterator. #include #include #include using namespace std; int main() { set con; int vals[] = {3,1,4,1,5,9}; copy(vals, vals+6, insert_iterator< set >(con, con.end())); copy(con.begin(), con.end(), ostream_iterator(cout, " ")); cout << '\n'; }