string::compare() problem?
Andrew Walrond
andrew@walrond.org
Sun Mar 21 17:04:00 GMT 2004
Hi Paolo
On Sunday 21 Mar 2004 16:27, Paolo Carlini wrote:
>
> first, the current behavior is correct: strings are compared
> "lexicographically":
> ever wondered why in your dictionary 'express' comes before
> 'expressionism'? ;)
>
My usual resource, O'Reilly's C++ In A Nutshell, says:
"Returns traits::compare(data(), str.data(), len) in which len is the smaller
of size() and str.size()"
Hence my query/confusion :) On reflection, it's obviously wrong. I assume
a.compare(0,2,b) will do what I need.
I'll send an errata to O'Reilly :)
Thanks
Andrew
More information about the Libstdc++
mailing list