This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch] Qualify less() and min() in basic_string.h


Hi,

same issue, different v3 file. Seems safe to me.

Tested x86-linux, if nobody complains will commit tomorrow.

Ciao, Paolo.

//////////////
2002-12-02  Paolo Carlini  <pcarlini@unitus.it>

	* include/bits/basic_string.h
	(assign(const _CharT*, size_type), insert(size_type,
	const _CharT*, size_type), replace(size_type, size_type,
	const _CharT*, size_type)): Fully qualify less() with std::.
	(compare(const basic_string&)): Ditto for min().
--- basic_string.h.~1.26.~	2002-09-11 01:19:10.000000000 +0200
+++ basic_string.h	2002-12-02 01:30:50.000000000 +0100
@@ -514,8 +514,8 @@
       {
 	if (__n > this->max_size())
 	  __throw_length_error("basic_string::assign");
-	if (_M_rep()->_M_is_shared() || less<const _CharT*>()(__s, _M_data())
-	    || less<const _CharT*>()(_M_data() + this->size(), __s))
+	if (_M_rep()->_M_is_shared() || std::less<const _CharT*>()(__s, _M_data())
+	    || std::less<const _CharT*>()(_M_data() + this->size(), __s))
 	  return _M_replace_safe(_M_ibegin(), _M_iend(), __s, __s + __n);
 	else
 	  {
@@ -576,8 +576,8 @@
 	  __throw_out_of_range("basic_string::insert");
 	if (__size > this->max_size() - __n)
 	  __throw_length_error("basic_string::insert");
-	if (_M_rep()->_M_is_shared() || less<const _CharT*>()(__s, _M_data())
-	    || less<const _CharT*>()(_M_data() + __size, __s))
+	if (_M_rep()->_M_is_shared() || std::less<const _CharT*>()(__s, _M_data())
+	    || std::less<const _CharT*>()(_M_data() + __size, __s))
 	  return _M_replace_safe(_M_ibegin() + __pos, _M_ibegin() + __pos,
 				 __s, __s + __n);
 	else
@@ -666,8 +666,8 @@
 	const size_type __foldn1 = __testn1 ? __n1 : __size - __pos;
 	if (__size - __foldn1 > this->max_size() - __n2)
 	  __throw_length_error("basic_string::replace");
-	if (_M_rep()->_M_is_shared() || less<const _CharT*>()(__s, _M_data())
-	    || less<const _CharT*>()(_M_data() + __size, __s))
+	if (_M_rep()->_M_is_shared() || std::less<const _CharT*>()(__s, _M_data())
+	    || std::less<const _CharT*>()(_M_data() + __size, __s))
 	  return _M_replace_safe(_M_ibegin() + __pos,
 				 _M_ibegin() + __pos + __foldn1, __s, __s + __n2);
 	// Todo: optimized in-place replace.
@@ -911,7 +911,7 @@
       {
 	size_type __size = this->size();
 	size_type __osize = __str.size();
-	size_type __len = min(__size, __osize);
+	size_type __len = std::min(__size, __osize);
 
 	int __r = traits_type::compare(_M_data(), __str.data(), __len);
 	if (!__r)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]