[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: String less bug patch
From: |
David Sugar |
Subject: |
Re: String less bug patch |
Date: |
Tue, 10 Feb 2004 09:17:09 -0500 |
User-agent: |
KMail/1.5.3 |
This patch I took in for 1.1.1.
On Monday 09 February 2004 11:18 pm, Jeffrey B. Reed wrote:
> I downloaded commoncpp2-1.1.0 and compiled some code that I had
> exercising persistence objects. I found that the new String object
> introduced a bug when using them as keys in a std::map. std::map relies
> on less<String> to order the map. This is used during insert, find
> etc. Less uses the following prototype to compare the objects
>
> bool String::operator<(const String&) const;
>
> This method was not supported as shown instead the method was declared
> as:
>
> bool String::operator<(const String&);
>
> Since this does not match what less was looking for, it ended up using
> less<const char*> by converting const String to const char* using:
>
> inline String::operator char *() const;
>
> This of course did not produce the correct results.
>
> I have taken the liberty of including a patch. I have modified some of
> the true constant method declarations and implementations. I did not
> get all of them I am sure, but this is a start.
>
> Let me if you have any problems with description or the patch.
>
> Regards,
>
> Jeff