Project

General

Profile

Feature #3077

Request comparison functions for art::Ptr

Added by Rob Kutschke over 6 years ago. Updated over 6 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
10/27/2012
Due date:
% Done:

0%

Estimated time:
Scope:
Internal
Experiment:
-
SSI Package:
Duration:

Description

Please add the following function templates, or equivalent, to the Ptr.h. Feel free to change the names of the function templates. I have written them as free functions but I would also be happy with member functions, or even member operator functions if you prefer. Please add whatever other comparison operators you think make a complete set.

bool lessThan ( const art::Ptr<T>& p0, const art::Ptr<T>& p1 ){
if ( p0.id() < p1.id() ) {
return true;
} else if ( p0.id() p1.id() ) {
return ( p0.key() < p1.key() );
}
return false;
}
bool equal ( const art::Ptr&lt;T&gt;& p0, const art::Ptr&lt;T&gt;& p1 ){
return ( p0.id() p1.id() && p0.key() p1.key() );
}

I did not write operator< and operator since there could be ambiguity about the sorting criteria - one could also consider sorting be address of pointee. Should we also add that set of functions - I don't see the need at the moment?

Rob

History

#1 Updated by Rob Kutschke over 6 years ago

<emily Littela voice>Never mind</emily Littela voice>

I looked for operators < and == but did not see them. Anderi pointed out that they are indeed there.

#2 Updated by Christopher Green over 6 years ago

  • Status changed from New to Rejected

Already present.



Also available in: Atom PDF