2010-03-28 16:08:35 +00:00
< html >
< head >
< meta http-equiv = "Content-Type" content = "text/html; charset=US-ASCII" >
2010-04-28 16:09:03 +00:00
< title > rotate</ title >
2010-03-28 16:08:35 +00:00
< link rel = "stylesheet" href = "../../../../../../../../doc/html/boostbook.css" type = "text/css" >
2010-04-08 19:09:34 +00:00
< meta name = "generator" content = "DocBook XSL Stylesheets V1.75.1" >
2010-03-28 16:08:35 +00:00
< link rel = "home" href = "../../../../index.html" title = "Chapter 1. Range 2.0" >
2010-04-28 16:09:03 +00:00
< link rel = "up" href = "../mutating.html" title = "Mutating algorithms" >
< link rel = "prev" href = "reverse_copy.html" title = "reverse_copy" >
< link rel = "next" href = "rotate_copy.html" title = "rotate_copy" >
2010-03-28 16:08:35 +00:00
</ head >
< body bgcolor = "white" text = "black" link = "#0000FF" vlink = "#840084" alink = "#0000FF" >
< table cellpadding = "2" width = "100%" >< tr >
< td valign = "top" >< img alt = "Boost C++ Libraries" width = "277" height = "86" src = "../../../../../../../../boost.png" ></ td >
< td align = "center" >< a href = "../../../../../../../../index.html" > Home</ a ></ td >
< td align = "center" >< a href = "../../../../../../../libraries.htm" > Libraries</ a ></ td >
< td align = "center" >< a href = "http://www.boost.org/users/people.html" > People</ a ></ td >
< td align = "center" >< a href = "http://www.boost.org/users/faq.html" > FAQ</ a ></ td >
< td align = "center" >< a href = "../../../../../../../../more/index.htm" > More</ a ></ td >
</ tr ></ table >
< hr >
< div class = "spirit-nav" >
2010-04-28 16:09:03 +00:00
< a accesskey = "p" href = "reverse_copy.html" >< img src = "../../../../../../../../doc/html/images/prev.png" alt = "Prev" ></ a >< a accesskey = "u" href = "../mutating.html" >< img src = "../../../../../../../../doc/html/images/up.png" alt = "Up" ></ a >< a accesskey = "h" href = "../../../../index.html" >< img src = "../../../../../../../../doc/html/images/home.png" alt = "Home" ></ a >< a accesskey = "n" href = "rotate_copy.html" >< img src = "../../../../../../../../doc/html/images/next.png" alt = "Next" ></ a >
2010-03-28 16:08:35 +00:00
</ div >
2010-04-28 16:09:03 +00:00
< div class = "section" title = "rotate" >
2010-03-28 16:08:35 +00:00
< div class = "titlepage" >< div >< div >< h5 class = "title" >
2010-04-28 16:09:03 +00:00
< a name = "range.reference.algorithms.mutating.rotate" ></ a >< a class = "link" href = "rotate.html" title = "rotate" > rotate</ a >
2010-03-28 16:08:35 +00:00
</ h5 ></ div ></ div ></ div >
2010-04-28 16:09:03 +00:00
< a name = "range.reference.algorithms.mutating.rotate.prototype" ></ a >< h6 >
2010-04-28 19:27:44 +00:00
< a name = "id3104755" ></ a >
2010-04-28 16:09:03 +00:00
< a class = "link" href = "rotate.html#range.reference.algorithms.mutating.rotate.prototype" > Prototype</ a >
2010-03-28 16:08:35 +00:00
</ h6 >
< p >
</ p >
< pre class = "programlisting" >< span class = "keyword" > template</ span >< span class = "special" > < </ span >< span class = "keyword" > class</ span > < span class = "identifier" > ForwardRange</ span >< span class = "special" > > </ span >
< span class = "identifier" > ForwardRange</ span >< span class = "special" > & </ span > < span class = "identifier" > rotate</ span >< span class = "special" > (</ span >< span class = "identifier" > ForwardRange</ span >< span class = "special" > & </ span > < span class = "identifier" > rng</ span >< span class = "special" > ,</ span >
< span class = "keyword" > typename</ span > < span class = "identifier" > range_iterator</ span >< span class = "special" > < </ span >< span class = "identifier" > ForwardRange</ span >< span class = "special" > > ::</ span >< span class = "identifier" > type</ span > < span class = "identifier" > middle</ span >< span class = "special" > );</ span >
2010-04-28 16:09:03 +00:00
2010-03-28 16:08:35 +00:00
< span class = "keyword" > template</ span >< span class = "special" > < </ span >< span class = "keyword" > class</ span > < span class = "identifier" > ForwardRange</ span >< span class = "special" > > </ span >
< span class = "keyword" > const</ span > < span class = "identifier" > ForwardRange</ span >< span class = "special" > & </ span > < span class = "identifier" > rotate</ span >< span class = "special" > (</ span >< span class = "keyword" > const</ span > < span class = "identifier" > ForwardRange</ span >< span class = "special" > & </ span > < span class = "identifier" > rng</ span >< span class = "special" > ,</ span >
< span class = "keyword" > typename</ span > < span class = "identifier" > range_iterator</ span >< span class = "special" > < </ span >< span class = "keyword" > const</ span > < span class = "identifier" > ForwardRange</ span >< span class = "special" > > ::</ span >< span class = "identifier" > type</ span > < span class = "identifier" > middle</ span >< span class = "special" > );</ span >
</ pre >
< p >
</ p >
2010-04-28 16:09:03 +00:00
< a name = "range.reference.algorithms.mutating.rotate.description" ></ a >< h6 >
2010-04-28 19:27:44 +00:00
< a name = "id3105016" ></ a >
2010-04-28 16:09:03 +00:00
< a class = "link" href = "rotate.html#range.reference.algorithms.mutating.rotate.description" > Description</ a >
2010-03-28 16:08:35 +00:00
</ h6 >
< p >
< code class = "computeroutput" >< span class = "identifier" > rotate</ span ></ code > rotates the elements
in a range. It exchanges the two ranges < code class = "computeroutput" >< span class = "special" > [</ span >< span class = "identifier" > begin</ span >< span class = "special" > (</ span >< span class = "identifier" > rng</ span >< span class = "special" > ),</ span > < span class = "identifier" > middle</ span >< span class = "special" > )</ span ></ code >
and < code class = "computeroutput" >< span class = "special" > [</ span >< span class = "identifier" > middle</ span >< span class = "special" > ,</ span > < span class = "identifier" > end</ span >< span class = "special" > (</ span >< span class = "identifier" > rng</ span >< span class = "special" > ))</ span ></ code > . Returns a reference to < code class = "computeroutput" >< span class = "identifier" > rng</ span ></ code > .
</ p >
2010-04-28 16:09:03 +00:00
< a name = "range.reference.algorithms.mutating.rotate.definition" ></ a >< h6 >
2010-04-28 19:27:44 +00:00
< a name = "id3105140" ></ a >
2010-04-28 16:09:03 +00:00
< a class = "link" href = "rotate.html#range.reference.algorithms.mutating.rotate.definition" > Definition</ a >
2010-03-28 16:08:35 +00:00
</ h6 >
< p >
Defined in the header file < code class = "computeroutput" >< span class = "identifier" > boost</ span >< span class = "special" > /</ span >< span class = "identifier" > range</ span >< span class = "special" > /</ span >< span class = "identifier" > algorithm</ span >< span class = "special" > /</ span >< span class = "identifier" > rotate</ span >< span class = "special" > .</ span >< span class = "identifier" > hpp</ span ></ code >
</ p >
2010-04-28 16:09:03 +00:00
< a name = "range.reference.algorithms.mutating.rotate.requirements" ></ a >< h6 >
2010-04-28 19:27:44 +00:00
< a name = "id3105213" ></ a >
2010-04-28 16:09:03 +00:00
< a class = "link" href = "rotate.html#range.reference.algorithms.mutating.rotate.requirements" > Requirements</ a >
2010-03-28 16:08:35 +00:00
</ h6 >
< div class = "itemizedlist" >< ul class = "itemizedlist" type = "disc" >
< li class = "listitem" >
< code class = "computeroutput" >< span class = "identifier" > ForwardRange</ span ></ code > is a model
of the < a class = "link" href = "../../../concepts/forward_range.html" title = "Forward Range" > Forward Range</ a >
Concept.
</ li >
< li class = "listitem" >
< code class = "computeroutput" >< span class = "identifier" > ForwardRange</ span ></ code > is mutable.
</ li >
</ ul ></ div >
2010-04-28 16:09:03 +00:00
< a name = "range.reference.algorithms.mutating.rotate.precondition_" ></ a >< h6 >
2010-04-28 19:27:44 +00:00
< a name = "id3105276" ></ a >
2010-04-28 16:09:03 +00:00
< a class = "link" href = "rotate.html#range.reference.algorithms.mutating.rotate.precondition_" > Precondition:</ a >
2010-03-28 16:08:35 +00:00
</ h6 >
< div class = "itemizedlist" >< ul class = "itemizedlist" type = "disc" >
< li class = "listitem" >
< code class = "computeroutput" >< span class = "special" > [</ span >< span class = "identifier" > begin</ span >< span class = "special" > (</ span >< span class = "identifier" > rng</ span >< span class = "special" > ),</ span > < span class = "identifier" > middle</ span >< span class = "special" > )</ span ></ code > is a valid range.
</ li >
< li class = "listitem" >
< code class = "computeroutput" >< span class = "special" > [</ span >< span class = "identifier" > middle</ span >< span class = "special" > ,</ span > < span class = "identifier" > end</ span >< span class = "special" > (</ span >< span class = "identifier" > rng</ span >< span class = "special" > ))</ span ></ code > is a valid range.
</ li >
</ ul ></ div >
2010-04-28 16:09:03 +00:00
< a name = "range.reference.algorithms.mutating.rotate.complexity" ></ a >< h6 >
2010-04-28 19:27:44 +00:00
< a name = "id3105386" ></ a >
2010-04-28 16:09:03 +00:00
< a class = "link" href = "rotate.html#range.reference.algorithms.mutating.rotate.complexity" > Complexity</ a >
2010-03-28 16:08:35 +00:00
</ h6 >
< p >
Linear. At most < code class = "computeroutput" >< span class = "identifier" > distance</ span >< span class = "special" > (</ span >< span class = "identifier" > rng</ span >< span class = "special" > )</ span ></ code > swaps are performed.
</ p >
</ div >
< table xmlns:rev = "http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width = "100%" >< tr >
< td align = "left" ></ td >
< td align = "right" >< div class = "copyright-footer" > Copyright © 2003 -2010 Thorsten Ottosen, Neil Groves< p >
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at < a href = "http://www.boost.org/LICENSE_1_0.txt" target = "_top" > http://www.boost.org/LICENSE_1_0.txt</ a > )
</ p >
</ div ></ td >
</ tr ></ table >
< hr >
< div class = "spirit-nav" >
2010-04-28 16:09:03 +00:00
< a accesskey = "p" href = "reverse_copy.html" >< img src = "../../../../../../../../doc/html/images/prev.png" alt = "Prev" ></ a >< a accesskey = "u" href = "../mutating.html" >< img src = "../../../../../../../../doc/html/images/up.png" alt = "Up" ></ a >< a accesskey = "h" href = "../../../../index.html" >< img src = "../../../../../../../../doc/html/images/home.png" alt = "Home" ></ a >< a accesskey = "n" href = "rotate_copy.html" >< img src = "../../../../../../../../doc/html/images/next.png" alt = "Next" ></ a >
2010-03-28 16:08:35 +00:00
</ div >
</ body >
</ html >