|
Boost : |
From: Jim Argeropoulos (jaa_at_[hidden])
Date: 2000-01-14 20:21:31
Well since I have gotten no response, I thought I would post the purpose of my submission to see if this helped.
Jim
Purpse:
Given:
class Person
{
public :
// Some interface...
const std::string& GetName ( ) const ;
// ...some more definition
} ;
typedef vector < Person* > PersonVector ;
typedef PersonVector::iterator PersonVecIter ;
typedef PersonVector::const_iterator PersonVecConstIter ;
This library allows you to substitue the following functor code:
struct LessPersonByName : public binary_function < PersonVecConstIter , PersonVecConstIter , bool >
{
bool operator ( ) (
PersonVecConstIter inLHS ,
PersonVecConstIter inRHS )
{ return inLHS->GetName ( ) < inRHS->GetName ( ) ; }
}
//...
sort ( aPersonVec.begin ( ) ,
aPersonVec.end ( ) ,
LessPersonByName ( ) ) ;
With this:
sort ( aPersonVec.begin ( ) ,
aPersonVec.end ( ) ,
LessMemberFunc ( &Person::GetName ) ) ;
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk