Boost logo

Boost-Commit :

From: philgarofalo_at_[hidden]
Date: 2007-12-29 21:50:11


Author: pgarofalo
Date: 2007-12-29 21:50:10 EST (Sat, 29 Dec 2007)
New Revision: 42355
URL: http://svn.boost.org/trac/boost/changeset/42355

Log:
Oops, need reverse_args.
Text files modified:
   sandbox/boost/sequence_algo/combinatorial.hpp | 16 ++++++++++++----
   1 files changed, 12 insertions(+), 4 deletions(-)

Modified: sandbox/boost/sequence_algo/combinatorial.hpp
==============================================================================
--- sandbox/boost/sequence_algo/combinatorial.hpp (original)
+++ sandbox/boost/sequence_algo/combinatorial.hpp 2007-12-29 21:50:10 EST (Sat, 29 Dec 2007)
@@ -74,7 +74,7 @@
     protected:
         const Predicate pred;
     public:
- explicit binary_reverse(const Predicate& x) : pred(x) {}
+ binary_reverse(const Predicate& x) : pred(x) {}
         typename BINFUNC::result_type operator()(
             const typename BINFUNC::first_argument_type& x,
             const typename BINFUNC::second_argument_type& y) const
@@ -83,6 +83,13 @@
         }
     }; // binary_reverse class
 
+ template <class Predicate>
+ inline binary_reverse<Predicate>
+ reverse_args(const Predicate& pred)
+ {
+ return binary_reverse<Predicate>(pred);
+ }
+
     // Two exception objects
 
     // combinatorial_range_error ------------------------------------------//
@@ -230,7 +237,7 @@
                 if (i == first)
                 {
                     std::partial_sort(first, r, last,
- binary_reverse(std::less<T>()));
+ reverse_args(std::less<T>()));
                     return false; // we're done--end of permutations
                 }
                 else
@@ -239,7 +246,7 @@
             {
                 std::swap(*i,* k);
                 std::partial_sort(i+1, r, last,
- binary_reverse(std::less<T>())); // O(n lg n), heapsort
+ reverse_args(std::less<T>())); // O(n lg n), heapsort
                 return true;
             } // else
         } // while
@@ -272,7 +279,8 @@
             if (k == last) // Didn't find it.
                 if (i == first)
                 {
- std::partial_sort(first, r, last, binary_reverse<Compare>(comp));
+ std::partial_sort(first, r, last,
+ binary_reverse<Compare>(comp));
                     return false; // we're done--end of permutations
                 }
                 else


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