stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject svn commit: r369588 - /incubator/stdcxx/trunk/include/rw/_algobase.h
Date Mon, 16 Jan 2006 22:26:31 GMT
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  <sebor@roguewave.com>

	* _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);
     }
 };
 



Mime
View raw message