|
Boost-Commit : |
From: philgarofalo_at_[hidden]
Date: 2008-01-11 22:19:10
Author: pgarofalo
Date: 2008-01-11 22:19:09 EST (Fri, 11 Jan 2008)
New Revision: 42690
URL: http://svn.boost.org/trac/boost/changeset/42690
Log:
Added SKIPSORTCHECK conditions to the next_ and prev_partial_combination functions. Define SKIPSORTCHECK to skip the test for sorted input sequence at the beginning of these functions. If you know the sequence is sorted there's no need to expend cycles performing this test.
Text files modified:
sandbox/boost/sequence_algo/combinatorial.hpp | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
Modified: sandbox/boost/sequence_algo/combinatorial.hpp
==============================================================================
--- sandbox/boost/sequence_algo/combinatorial.hpp (original)
+++ sandbox/boost/sequence_algo/combinatorial.hpp 2008-01-11 22:19:09 EST (Fri, 11 Jan 2008)
@@ -319,8 +319,10 @@
return false;
if (!(first < middle && middle <= last))
throw combinatorial_range_error("next_partial_combination");
+#ifndef SKIPSORTCHECK
if (!is_sorted(first, middle))
throw combinatorial_sequence_disorder("next_partial_combination");
+#endif // SKIPSORTCHECK
RandomAccessIterator i = middle - 1;
while(true)
@@ -368,8 +370,10 @@
return false;
if (!(first < middle && middle <= last))
throw combinatorial_range_error("next_partial_combination");
+#ifndef SKIPSORTCHECK
if (!is_sorted(first, middle, comp))
throw combinatorial_sequence_disorder("next_partial_combination");
+#endif // SKIPSORTCHECK
RandomAccessIterator i = middle - 1;
while(true)
@@ -424,8 +428,10 @@
return false;
if (!(first < middle && middle <= last))
throw combinatorial_range_error("prev_partial_combination");
+#ifndef SKIPSORTCHECK
if (!is_sorted(first, middle))
throw combinatorial_sequence_disorder("prev_partial_combination");
+#endif // SKIPSORTCHECK
std::sort(middle, last);
for (RandomAccessIterator i = last - 1; i >= middle; --i)
@@ -455,8 +461,10 @@
return false;
if (!(first < middle && middle <= last))
throw combinatorial_range_error("prev_partial_combination");
+#ifndef SKIPSORTCHECK
if (!is_sorted(first, middle, comp))
throw combinatorial_sequence_disorder("prev_partial_combination");
+#endif // SKIPSORTCHECK
std::sort(middle, last, comp);
for (RandomAccessIterator i = last - 1; i >= middle; i--)
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk