|
ALINK="#ff0000">
advance
Prototypetemplate <class InputIterator, class Distance> void advance(InputIterator& i, Distance n); DescriptionAdvance(i, n) increments the iterator i by the distance n. If n > 0 it is equivalent to executing ++i n times, and if n < 0 it is equivalent to executing --i n times. If n == 0, the call has no effect.DefinitionDefined in the standard header iterator, and in the nonstandard backward-compatibility header iterator.h.Requirements on types
Preconditions
ComplexityConstant time if InputIterator is a model of random access iterator, otherwise linear time.Examplelist<int> L; L.push_back(0); L.push_back(1); list<int>::iterator i = L.begin(); advance(i, 2); assert(i == L.end()); NotesSee alsodistance, Input iterator, Bidirectional Iterator, Random access iterator, iterator_traits, Iterator overview.Copyright © 1999 Silicon Graphics, Inc. All Rights Reserved. TrademarkInformation
|