![]() |
![]() |
Category: algorithms | Component type: function |
template <class OutputIterator, class Size, class Generator> OutputIterator generate_n(OutputIterator first, Size n, Generator gen);
generate_n(ostream_iterator<int>(cout, "\n"), 100, rand);
[1] The function object gen is invoked n times (once for each iterator in the range [first, first+n)), as opposed to just being invoked a single time outside the loop. This distinction is important because a Generator need not return the same result each time it is invoked; it is permitted to read from a file, refer to and modify local state, and so on.
Using this site means you accept its terms of use | privacy policy | | | trademark information |
Copyright © 1993-2003 Silicon Graphics, Inc. All rights reserved. | | | contact us |