OSSP CVS Repository

ossp - Ticket #168
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Attach]  [Edit]  [History

Ticket 168: Comparison operators for C++ uuid object not const

For a uuid object to be used in many contexts (eg. as the key of a map), the uuid object must satisfy this condition: (const uuid &) < (const uuid &)

Right now, it only satisfies this condition: (uuid &) < (const uuid &)

This is because all the comparison operators (operator==, operator<, etc) are non-const members. There is no reason for this since the definition of the underlying function (uuid_compare) is defined to take two const arguments, therefore the operator overload should be able to be const without consequence.

This severely limits the use of a uuid object, and means that end-users must implement ugly workarounds (eg. a free-standing operator< for uuid that does a const-cast or something).

[Append remarks]

Remarks:

2008-Jul-03 20:35:59 by anonymous:
This also goes for the .string(), .binary() and such functions too.

Basically anything that calls an underlying c function that takes a const uuid_t argument (ie. anything that does not modify the uuid itself) should be a const member.

2008-Jul-04 14:35:59 by rse
OK, this is now changed for the next version of OSSP uuid. All methods which do not change the UUID object are now "const member functions".

[Append remarks]

Properties:

Type: code           Version: 1.6.1 
Status: fixed          Created: 2008-Jul-03 20:25
Severity:          Last Change: 2008-Jul-05 14:51
Priority:          Subsystem: uuid 
Assigned To: rse           Derived From:  
Creator: anonymous 

CVSTrac 2.0.1