Boost logo

Boost Users :

From: Olaf van der Spek (olafvdspek_at_[hidden])
Date: 2006-03-03 17:29:58

On 3/3/06, Pavol Droba <droba_at_[hidden]> wrote:
> > What about 'A' vs 'a'? Shouldn't 'A' < 'a'?
> Hmm, interesting point. But it is not fully correct. Take this example:
> str1="Aab"
> str2="aAa"
> in my opinion following should hold str1>str2, however if 'A' < 'a' then the comparison
> would yield the oposite.
> Such a comparison make sense only if both strings are equal (except the case).

True, I only realized that later.

> Current implementation of ilexicographical_compare does not perform this extra step
> since it tries to be compliant with std::lexicographical_compare.
> >
> > I'm also wondering how expensive std::toupper is. Would it make sense to
> > do a == first to avoid the std::toupper calls in certain cases?
> >
> Well, this is a more complicated point. Small optimization you are proposing
> does not really make any difference. I have read a paper (I don't remember where),

Why not?
Isn't a simple compare much faster than two table lookup?

> where author proposes to cache the results of tolower during the comparison.

I'm not sure how that would work, could you explain?

> This approch is complex and it effectively disables the possibility to
> use user-defined comparison predicates. So I decided to go for a simple solution.
> Best regards,
> Pavol
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at