From: Maciej Sobczak (maciej_at_[hidden])
Date: 2002-07-25 02:02:32
Victor A. Wagner, Jr. wrote:
> I've noticed in our coding, we sometimes need a comparison operator that
> works on just a single element in a struct, instead of the "entire
> struct". If we need to sort the container using just this "key"; we, of
> course, write the comparison function/functor and then:
> I decided to write a couple templates and helper functions called (the
> ones you'd use) less_element() and greater_element().
It is not very flexible.
What about function objects that are not yet invented?
Some time ago I wrote the adaptor class that allows you to wrap
*arbitrary* functor (less, greater, etc.) in a uniform manner:
(please scroll down the page to the third example - the others are used
by me in flame wars with Java extremists ;-) and are not relevant here)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk