| <html> |
| <head> |
| <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> |
| <title>next_permutation</title> |
| <link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css"> |
| <meta name="generator" content="DocBook XSL Stylesheets V1.75.2"> |
| <link rel="home" href="../../../../index.html" title="Chapter 1. Range 2.0"> |
| <link rel="up" href="../permutation.html" title="Permutation algorithms"> |
| <link rel="prev" href="../permutation.html" title="Permutation algorithms"> |
| <link rel="next" href="prev_permutation.html" title="prev_permutation"> |
| </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="../../../../../../../../libs/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"> |
| <a accesskey="p" href="../permutation.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../permutation.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="prev_permutation.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a> |
| </div> |
| <div class="section"> |
| <div class="titlepage"><div><div><h5 class="title"> |
| <a name="range.reference.algorithms.permutation.next_permutation"></a><a class="link" href="next_permutation.html" title="next_permutation">next_permutation</a> |
| </h5></div></div></div> |
| <a name="range.reference.algorithms.permutation.next_permutation.prototype"></a><h6> |
| <a name="id743032"></a> |
| <a class="link" href="next_permutation.html#range.reference.algorithms.permutation.next_permutation.prototype">Prototype</a> |
| </h6> |
| <p> |
| |
| </p> |
| <pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">BidirectionalRange</span><span class="special">></span> |
| <span class="keyword">bool</span> <span class="identifier">next_permutation</span><span class="special">(</span><span class="identifier">BidirectionalRange</span><span class="special">&</span> <span class="identifier">rng</span><span class="special">);</span> |
| |
| <span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">BidirectionalRange</span><span class="special">></span> |
| <span class="keyword">bool</span> <span class="identifier">next_permutation</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">BidirectionalRange</span><span class="special">&</span> <span class="identifier">rng</span><span class="special">);</span> |
| |
| <span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">BidirectionalRange</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Compare</span><span class="special">></span> |
| <span class="keyword">bool</span> <span class="identifier">next_permutation</span><span class="special">(</span><span class="identifier">BidirectionalRange</span><span class="special">&</span> <span class="identifier">rng</span><span class="special">,</span> <span class="identifier">Compare</span> <span class="identifier">pred</span><span class="special">);</span> |
| |
| <span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">BidirectionalRange</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Compare</span><span class="special">></span> |
| <span class="keyword">bool</span> <span class="identifier">next_permutation</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">BidirectionalRange</span><span class="special">&</span> <span class="identifier">rng</span><span class="special">,</span> <span class="identifier">Compare</span> <span class="identifier">pred</span><span class="special">);</span> |
| </pre> |
| <p> |
| </p> |
| <a name="range.reference.algorithms.permutation.next_permutation.description"></a><h6> |
| <a name="id743378"></a> |
| <a class="link" href="next_permutation.html#range.reference.algorithms.permutation.next_permutation.description">Description</a> |
| </h6> |
| <p> |
| <code class="computeroutput"><span class="identifier">next_permutation</span></code> transforms |
| the range of elements <code class="computeroutput"><span class="identifier">rng</span></code> |
| into the lexicographically next greater permutation of the elements if |
| such a permutation exists. If one does not exist then the range is transformed |
| into the lexicographically smallest permutation and <code class="computeroutput"><span class="keyword">false</span></code> |
| is returned. <code class="computeroutput"><span class="keyword">true</span></code> is returned |
| when the next greater permutation is successfully generated. |
| </p> |
| <p> |
| The ordering relationship is determined by using <code class="computeroutput"><span class="keyword">operator</span><span class="special"><</span></code> in the non-predicate versions, and |
| by evaluating <code class="computeroutput"><span class="identifier">pred</span></code> in |
| the predicate versions. |
| </p> |
| <a name="range.reference.algorithms.permutation.next_permutation.definition"></a><h6> |
| <a name="id743477"></a> |
| <a class="link" href="next_permutation.html#range.reference.algorithms.permutation.next_permutation.definition">Definition</a> |
| </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">permutation</span><span class="special">.</span><span class="identifier">hpp</span></code> |
| </p> |
| <a name="range.reference.algorithms.permutation.next_permutation.requirements"></a><h6> |
| <a name="id743548"></a> |
| <a class="link" href="next_permutation.html#range.reference.algorithms.permutation.next_permutation.requirements">Requirements</a> |
| </h6> |
| <p> |
| <span class="bold"><strong>For the non-predicate versions:</strong></span> |
| </p> |
| <div class="itemizedlist"><ul class="itemizedlist" type="disc"> |
| <li class="listitem"> |
| <code class="computeroutput"><span class="identifier">BidirectionalRange</span></code> |
| is a model of the <a class="link" href="../../../concepts/bidirectional_range.html" title="Bidirectional Range">Bidirectional |
| Range</a> Concept. |
| </li> |
| <li class="listitem"> |
| <code class="computeroutput"><span class="identifier">BidirectionalRange</span></code> |
| is mutable. |
| </li> |
| <li class="listitem"> |
| <code class="computeroutput"><span class="identifier">BidirectionalRange</span></code>'s |
| value type is a model of the <code class="computeroutput"><span class="identifier">LessThanComparableConcept</span></code>. |
| </li> |
| <li class="listitem"> |
| The ordering of objects of type <code class="computeroutput"><span class="identifier">BidirectionalRange</span></code>'s |
| value type is a <span class="bold"><strong><span class="emphasis"><em>strict weak ordering</em></span></strong></span>, |
| as defined in the <code class="computeroutput"><span class="identifier">LessThanComparableConcept</span></code> |
| requirements. |
| </li> |
| </ul></div> |
| <p> |
| <span class="bold"><strong>For the predicate versions:</strong></span> |
| </p> |
| <div class="itemizedlist"><ul class="itemizedlist" type="disc"> |
| <li class="listitem"> |
| <code class="computeroutput"><span class="identifier">BidirectionalRange</span></code> |
| is a model of the <a class="link" href="../../../concepts/bidirectional_range.html" title="Bidirectional Range">Bidirectional |
| Range</a> Concept. |
| </li> |
| <li class="listitem"> |
| <code class="computeroutput"><span class="identifier">BidirectionalRange</span></code> |
| is mutable. |
| </li> |
| <li class="listitem"> |
| <code class="computeroutput"><span class="identifier">Compare</span></code> is a model |
| of the <code class="computeroutput"><span class="identifier">StrictWeakOrderingConcept</span></code>. |
| </li> |
| <li class="listitem"> |
| <code class="computeroutput"><span class="identifier">BidirectionalRange</span></code>'s |
| value type is convertible to both of <code class="computeroutput"><span class="identifier">Compare</span></code>'s |
| argument types. |
| </li> |
| </ul></div> |
| <a name="range.reference.algorithms.permutation.next_permutation.complexity"></a><h6> |
| <a name="id743796"></a> |
| <a class="link" href="next_permutation.html#range.reference.algorithms.permutation.next_permutation.complexity">Complexity</a> |
| </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> <span class="special">/</span> <span class="number">2</span></code> |
| swaps. |
| </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"> |
| <a accesskey="p" href="../permutation.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../permutation.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="prev_permutation.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a> |
| </div> |
| </body> |
| </html> |