![]() |
![]() |
Category: algorithms | Component type: function |
template <class ForwardIterator> inline ForwardIterator rotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last);
char alpha[] = "abcdefghijklmnopqrstuvwxyz"; rotate(alpha, alpha + 13, alpha + 26); printf("%s\n", alpha); // The output is nopqrstuvwxyzabcdefghijklm
[1] It follows from these two requirements that [first, last) is a valid range.
[2] Rotate uses a different algorithm depending on whether its arguments are Forward Iterators, Bidirectional Iterators, or Random Access Iterators. All three algorithms, however, are linear.
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 |