Hello,
I have to use a set of shared pointers to objects. The struct I have to
use looks like
struct eventIntLim
{
enum eType { eStart = 0, eEnd };
eType type;
double varianceBump;
eventIntLim(eType t, double v) : type(t), varianceBump(v)
{}
bool operator < (const eventIntLim &rhs) const
{
return fabs(varianceBump) <
fabs(rhs.varianceBump);
}
};
and the definition of the set is
typedef boost::shared_ptr<eventIntLim> eventIntLimPtr;
typedef std::set
eventIntLimPtrSet;
typedef std::map
eventIntLimMap;
In order to sort the objects in the set I have to use the functor
struct lessThan : public
std::binary_function
{
bool operator ()(const boost::shared_ptr<eventIntLim>
&lhs, const boost::shared_ptr<eventIntLim> &rhs) const
{
return (*lhs) < (*rhs);
}
};
This is quite long and I believe boost can shorten it a lot. I have tried
it with boost::lamba and boost::bind but could not make it working.
Basically I would like to eliminate the need of writing the definition of
struct lessThan. Could someone help me with that?
Cheers
___________________________________________________________
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is prohibited.
Please refer to http://www.bnpparibas.co.uk/en/information/legal_information.asp?Code=ECAS-8... for additional disclosures.