|
Boost : |
From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2001-08-17 07:45:39
Peter Dimov wrote:
>
> // std::less specializations do not help in cases like
> // map<pair<shared_ptr, int>, int>
> //
Maybe I don't understand the problem here, but given that less<> is
defined for the pair's sub-types, a generic less<> for pair could solve
this problem. Something like this:
namespace std
{
template< class First, class Second > struct less< pair< First,
Second > >
{
inline bool less< pair< First, Second > >::operator()( const pair<
First, Second >& x, const pair< First, Second >& y ) const
{
return less< First >()( x.first, y.first ) || ( !less< First
>()( y.first, x.first ) && less< Second >()( x.second, y.second ) );
}
};
}
Or is there something I'm missing here?
Regards, Daniel
-- Daniel Frey aixigo AG - financial training, research and technology Schloß-Rahe-Straße 15, 52072 Aachen, Germany fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99 eMail: daniel.frey_at_[hidden], web: http://www.aixigo.de
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk