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] In basic_string.tcc fully qualify min() uses with std::


Hi!

If I understand well Gaby reply to my last posting, the uses
of min() should be also fully qualified with std::.

Tested x86-linux. Ok?

Ciao, Paolo.

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

	* include/bits/basic_string.tcc
	(basic_string::append(const basic_string&, size_type,
	size_type), basic_string::compare(size_type, size_type,
	const basic_string&), basic_string::compare(size_type,
	size_type, const basic_string&, size_type, size_type),
	basic_string::compare(const _CharT*), basic_string::
	compare(size_type, size_type, const _CharT*),
	basic_string::compare(size_type, size_type, const _CharT*,
	size_type), _S_string_copy(const basic_string&, _CharT*,
	typename _Alloc::size_type)): Fully qualify min() with std::.
 
--- basic_string.tcc.~1.28.~	2002-11-01 18:30:35.000000000 +0100
+++ basic_string.tcc	2002-12-01 18:32:31.000000000 +0100
@@ -578,7 +578,7 @@
       // Iff appending itself, string needs to pre-reserve the
       // correct size so that _M_mutate does not clobber the
       // iterators formed here.
-      size_type __len = min(__str.size() - __pos, __n) + this->size();
+      size_type __len = std::min(__str.size() - __pos, __n) + this->size();
       if (__len > this->capacity())
 	this->reserve(__len);
       return _M_replace_safe(_M_iend(), _M_iend(), __str._M_check(__pos),
@@ -848,8 +848,8 @@
       if (__pos > __size)
 	__throw_out_of_range("basic_string::compare");
       
-      size_type __rsize= min(__size - __pos, __n);
-      size_type __len = min(__rsize, __osize);
+      size_type __rsize= std::min(__size - __pos, __n);
+      size_type __len = std::min(__rsize, __osize);
       int __r = traits_type::compare(_M_data() + __pos, __str.data(), __len);
       if (!__r)
 	__r = __rsize - __osize;
@@ -867,9 +867,9 @@
       if (__pos1 > __size || __pos2 > __osize)
 	__throw_out_of_range("basic_string::compare");
       
-      size_type __rsize = min(__size - __pos1, __n1);
-      size_type __rosize = min(__osize - __pos2, __n2);
-      size_type __len = min(__rsize, __rosize);
+      size_type __rsize = std::min(__size - __pos1, __n1);
+      size_type __rosize = std::min(__osize - __pos2, __n2);
+      size_type __len = std::min(__rsize, __rosize);
       int __r = traits_type::compare(_M_data() + __pos1, 
 				     __str.data() + __pos2, __len);
       if (!__r)
@@ -885,7 +885,7 @@
     {
       size_type __size = this->size();
       size_type __osize = traits_type::length(__s);
-      size_type __len = min(__size, __osize);
+      size_type __len = std::min(__size, __osize);
       int __r = traits_type::compare(_M_data(), __s, __len);
       if (!__r)
 	__r = __size - __osize;
@@ -903,8 +903,8 @@
 	__throw_out_of_range("basic_string::compare");
       
       size_type __osize = traits_type::length(__s);
-      size_type __rsize = min(__size - __pos, __n1);
-      size_type __len = min(__rsize, __osize);
+      size_type __rsize = std::min(__size - __pos, __n1);
+      size_type __len = std::min(__rsize, __osize);
       int __r = traits_type::compare(_M_data() + __pos, __s, __len);
       if (!__r)
 	__r = __rsize - __osize;
@@ -921,9 +921,9 @@
       if (__pos > __size)
 	__throw_out_of_range("basic_string::compare");
       
-      size_type __osize = min(traits_type::length(__s), __n2);
-      size_type __rsize = min(__size - __pos, __n1);
-      size_type __len = min(__rsize, __osize);
+      size_type __osize = std::min(traits_type::length(__s), __n2);
+      size_type __rsize = std::min(__size - __pos, __n1);
+      size_type __len = std::min(__rsize, __osize);
       int __r = traits_type::compare(_M_data() + __pos, __s, __len);
       if (!__r)
 	__r = __rsize - __osize;
@@ -937,7 +937,7 @@
     {
       typedef typename _Alloc::size_type size_type;
       size_type __strsize = __str.size();
-      size_type __bytes = min(__strsize, __bufsiz - 1);
+      size_type __bytes = std::min(__strsize, __bufsiz - 1);
       _Traits::copy(__buf, __str.data(), __bytes);
       __buf[__bytes] = _CharT();
     }

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