Angus Leeming <[EMAIL PROTECTED]> writes:
| On Tuesday 05 November 2002 12:08 pm, Lars Gullik Bj�nnes wrote:
>> Angus Leeming <[EMAIL PROTECTED]> writes:
>> | Doesn't fix getVectorFromString, but does reduce cpu usage thereafter.
>> | Ok to apply?
>>
>> yes.
>
| Thanks, but since I had the file open...
>
| I think that this is wrong:
>
| // A functor for use with std::sort, leading to case insensitive sorting
| struct compareNoCase: public std::binary_function<string, string, bool>
| {
| bool operator()(string const & s1, string const & s2) const {
| return compare_ascii_no_case(s1, s2) < 0;
| }
| };
>
| vector<string> const getKeys(InfoMap const & map)
| {
| vector<string> bibkeys = ...;
| sort(bibkeys.begin(), bibkeys.end(), compareNoCase());
| }
>
| Shouldn't sort use compare_ascii_no_case directly here? As written the code
| is using (a == b), but sort uses (a < b) doesn't it?
I think the code is right as it is.
sort would try to use std::less<string>(a, b) which would return
bool(a < b)
--
Lgb