This is the mail archive of the libstdc++@sourceware.cygnus.com 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]

Re: basic_string::compare



Hi Juergen:

v-3 is not v-2. . . . if you are trying to use a library that tracks the
standard, use v-3. See the FAQ and homepage for instructions on d/ling it.

Here are the prototypes for v-3's string:

      int 
      compare(const basic_string& __str) const
      {
	size_type __size = this->size();
	size_type __osize = __str.size();
	size_type __len = min(__size, __osize);
      
	int __r = traits_type::compare(_M_data(), __str.data(), __len);
	if (!__r)
	  __r =  __size - __osize;
	return __r;
      }

      int 
      compare(size_type __pos, size_type __n, const basic_string& __str)
const;

      int 
      compare(size_type __pos1, size_type __n1, const basic_string& __str,
	      size_type __pos2, size_type __n2) const;

      int 
      compare(const _CharT* __s) const;

      int 
      compare(size_type __pos, size_type __n1, const _CharT* __s, 
	      size_type __n2 = npos) const;

-Benjamin 

On Thu, 22 Jul 1999, Juergen Hermann wrote:
> Is it possible that the compare() prototypes are severely broken? From
> my sources they should be like this
> 
>     int compare(size_type p0, size_type n0, const basic_string& str);
> 
> while in the lib distributed with the current egcs they are like
> 
>     int compare(const basic_string& str, size_type p0, size_type n0);  


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