Author: sebor
Date: Mon Jan 16 14:26:28 2006
New Revision: 369588

URL: http://svn.apache.org/viewcvs?rev=369588&view=rev
Log:
2006-01-16  Martin Sebor  <[EMAIL PROTECTED]>

        * _algobase.h (__rw_lt::operator()): Declared arguments const to allow
        them to bind to rvalues and cast away their constness before invoking
        operator< in case it takes a non-const argument.

Modified:
    incubator/stdcxx/trunk/include/rw/_algobase.h

Modified: incubator/stdcxx/trunk/include/rw/_algobase.h
URL: 
http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/include/rw/_algobase.h?rev=369588&r1=369587&r2=369588&view=diff
==============================================================================
--- incubator/stdcxx/trunk/include/rw/_algobase.h (original)
+++ incubator/stdcxx/trunk/include/rw/_algobase.h Mon Jan 16 14:26:28 2006
@@ -137,8 +137,11 @@
 struct __rw_lt
 {
     template <class _TypeT, class _TypeU>
-    bool operator() (_TypeT &__lhs, _TypeU &__rhs) const {
-        return __lhs < __rhs;
+    bool operator() (const _TypeT &__lhs, const _TypeU &__rhs) const {
+        // cast away constness in case operator<
+        // takes a non-const argument
+        return   _RWSTD_CONST_CAST (_TypeT&, __lhs)
+               < _RWSTD_CONST_CAST (_TypeU&, __rhs);
     }
 };
 


Reply via email to