|
Boost : |
From: Jan Langer (jan_at_[hidden])
Date: 2003-03-28 14:50:01
David Abrahams wrote:
>>>> 3) I'd like to see a general solution for this problem using real
>>>>(late-bound) function objects as well, if you know what I mean. This would
>>>>be a lot harder, though, so maybe it should be put on a wish-list. Have you
>>>>given any thought to this approach?
>>>
>>> return compare.less(p1.x, p2.x)
>>> .greater(p1.y, p2.y)
>>> .call(f, p1.z, p2.z);
>>
>>now this would be:
>>
>>return compare (p1.x, p2.x, std::less <double> ())
>> (p1.y, p2.y, std::greater <double> ())
>> (p1.z, p2.z, f);
>
>
> The problem with that is that it requires you to name the type of the
> arguments (and they have to be the same).
but you have this problem always. and the set of member functions as you
suggest should be very limited anyway. when i think about it, only less
and greater out of the std-functors make sense at all. so these two are
taken care of as seen below.
>>or nearly the same:
>>
>>return compare (p1.x, p2.x)
>> (p2.y, p1.y)
>> (p1.z, p2.z, f);
jan
-- jan langer ... jan_at_[hidden] "pi ist genau drei"
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk