operator < for Handle classes

Hi,

(this message is for the OpenCASCADE team)

It will be usefull to have the operator It will allow us, users, to use the Handle classes in stl collections, instead of redefining a Less struct for comparison.

bool operator {
return this.operator->() ();
}

for use easily in :
ex :
std::map myMap;

for the moment, I have to :
struct HandleLess
{
// functor specialized for Handle for operator bool operator()(const Handle_Standard_Transient& _Left, const Handle_Standard_Transient& _Right) const
{
return (_Left.operator->() ());
}
};

std::map myMap;

just my 2 cents.

Stephane

Bearloga's picture

Why don't you define the global operator< ?

bool operator < (const Handle(Standard_Transient)& one,
const Handle(Standard_Transient)& other)
{
return one.operator->() < other.operator->();
}

Stephane Routelous's picture

I totally agree with you, but it is just a few lines to add to the existing OpenCASCADE code.