bug-commoncpp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

String less bug patch


From: Jeffrey B. Reed
Subject: String less bug patch
Date: 09 Feb 2004 22:18:26 -0600

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

-- 
Jeffrey B. Reed <address@hidden>

Attachment: string_less_patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]