|Category: algorithms||Component type: function|
template <class ForwardIterator, class T> void fill(ForwardIterator first, ForwardIterator last, const T& value);
vector<double> V(4); fill(V.begin(), V.end(), 137); assert(V == 137 && V == 137 && V == 137 && V == 137);
 The reason that fill requires its argument to be a mutable forward iterator, rather than merely an output iterator, is that it uses a range [first, last) of iterators. There is no sensible way to describe a range of output iterators, because it is impossible to compare two output iterators for equality. The fill_n algorithm does have an interface that permits use of an output iterator.
|Copyright © 2009 - 2016 Silicon Graphics International. All rights reserved.|