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]

Re: string::compare() problem?


Hi,

first, the current behavior is correct: strings are compared "lexicographically":
ever wondered why in your dictionary 'express' comes before 'expressionism'? ;)


Why doesn't this give 0? According to my reading of the function, it should only compare the first 2 chars of each string.

	int __r = traits_type::compare(_M_data(), __str.data(), __len);
	if (!__r)
	  __r =  __size - __osize;

If...

Paolo.


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