This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: operands to min and max must have the same type...
On Mar 5, 2003, Benjamin Kosnik <bkoz at redhat dot com> wrote:
> (note the lack of space).
> See C++STYLE.
Thanks, I didn't know about these guidelines. Fixed with the
following patch, that I'm checking in.
Index: libstdc++-v3/ChangeLog
from Alexandre Oliva <aoliva at redhat dot com>
* src/strstream.cc, include/bits/basic_string.tcc: Remove
incorrect whitespace added in my previous change.
Index: libstdc++-v3/src/strstream.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/src/strstream.cc,v
retrieving revision 1.16
diff -u -p -r1.16 strstream.cc
--- libstdc++-v3/src/strstream.cc 4 Mar 2003 21:21:44 -0000 1.16
+++ libstdc++-v3/src/strstream.cc 5 Mar 2003 22:23:33 -0000
@@ -148,7 +148,7 @@ namespace std
if (pptr() == epptr() && _M_dynamic && !_M_frozen && !_M_constant)
{
ptrdiff_t old_size = epptr() - pbase();
- ptrdiff_t new_size = std::max(ptrdiff_t (2 * old_size), ptrdiff_t (1));
+ ptrdiff_t new_size = std::max(ptrdiff_t(2 * old_size), ptrdiff_t(1));
char* buf = _M_alloc(new_size);
if (buf)
Index: libstdc++-v3/include/bits/basic_string.tcc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/basic_string.tcc,v
retrieving revision 1.32
diff -u -p -r1.32 basic_string.tcc
--- libstdc++-v3/include/bits/basic_string.tcc 4 Mar 2003 21:21:44 -0000 1.32
+++ libstdc++-v3/include/bits/basic_string.tcc 5 Mar 2003 22:23:33 -0000
@@ -578,7 +578,7 @@ namespace std
// 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 = std::min(size_type (__str.size() - __pos),
+ size_type __len = std::min(size_type(__str.size() - __pos),
__n) + this->size();
if (__len > this->capacity())
this->reserve(__len);
@@ -710,7 +710,7 @@ namespace std
size_type __size = this->size();
if (__n <= __size)
{
- __pos = std::min(size_type (__size - __n), __pos);
+ __pos = std::min(size_type(__size - __n), __pos);
const _CharT* __data = _M_data();
do
{
@@ -849,7 +849,7 @@ namespace std
if (__pos > __size)
__throw_out_of_range("basic_string::compare");
- size_type __rsize= std::min(size_type (__size - __pos), __n);
+ size_type __rsize= std::min(size_type(__size - __pos), __n);
size_type __len = std::min(__rsize, __osize);
int __r = traits_type::compare(_M_data() + __pos, __str.data(), __len);
if (!__r)
@@ -868,8 +868,8 @@ namespace std
if (__pos1 > __size || __pos2 > __osize)
__throw_out_of_range("basic_string::compare");
- size_type __rsize = std::min(size_type (__size - __pos1), __n1);
- size_type __rosize = std::min(size_type (__osize - __pos2), __n2);
+ size_type __rsize = std::min(size_type(__size - __pos1), __n1);
+ size_type __rosize = std::min(size_type(__osize - __pos2), __n2);
size_type __len = std::min(__rsize, __rosize);
int __r = traits_type::compare(_M_data() + __pos1,
__str.data() + __pos2, __len);
@@ -904,7 +904,7 @@ namespace std
__throw_out_of_range("basic_string::compare");
size_type __osize = traits_type::length(__s);
- size_type __rsize = std::min(size_type (__size - __pos), __n1);
+ size_type __rsize = std::min(size_type(__size - __pos), __n1);
size_type __len = std::min(__rsize, __osize);
int __r = traits_type::compare(_M_data() + __pos, __s, __len);
if (!__r)
@@ -923,7 +923,7 @@ namespace std
__throw_out_of_range("basic_string::compare");
size_type __osize = std::min(traits_type::length(__s), __n2);
- size_type __rsize = std::min(size_type (__size - __pos), __n1);
+ size_type __rsize = std::min(size_type(__size - __pos), __n1);
size_type __len = std::min(__rsize, __osize);
int __r = traits_type::compare(_M_data() + __pos, __s, __len);
if (!__r)
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva at {redhat dot com, gcc.gnu.org}
CS PhD student at IC-Unicamp oliva at {lsd dot ic dot unicamp dot br, gnu.org}
Free Software Evangelist Professional serial bug killer