![]()
|
ALINK="#ff0000">
iota
Prototypetemplate <class ForwardIterator, class T> void iota(ForwardIterator first, ForwardIterator last, T value); DescriptionIota assigns sequentially increasing values to a range. That is, it assigns value to *first, value + 1 to *(first + 1) and so on. In general, each iterator i in the range [first, last) is assigned value + (i - first). [1]DefinitionDefined in the standard header numeric, and in the nonstandard backward-compatibility header algo.h. This function is an SGI extension; it is not part of the C++ standard.Requirements on types
Preconditions
ComplexityLinear. Exactly last - first assignments.Example
int main()
{
vector<int> V(10);
iota(V.begin(), V.end(), 7);
copy(V.begin(), V.end(), ostream_iterator<int>(cout, " "));
cout << endl;
}
Notes[1] The name iota is taken from the programming language APL. See alsofill, generate, partial_sum
Copyright © 1999 Silicon Graphics, Inc. All Rights Reserved. TrademarkInformation
|