Boost logo

Boost :

From: Victor A. Wagner, Jr. (vawjr_at_[hidden])
Date: 2002-07-25 02:23:42


At Thursday 2002/07/25 00:02, you wrote:
>Hi Boosters,
>
>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:
>[snip]
>>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?

it's not "flexible" in that sense at all.... they ONLY does < and >. But
they ARE useable for std::sort() something that I don't see being able to
do w/ yours.
I'm reasonably certain they can be improved, but we've got to use MSVC so
there are limits to how fancy I can get at this point.

>Some time ago I wrote the adaptor class that allows you to wrap
>*arbitrary* functor (less, greater, etc.) in a uniform manner:
>
>http://www.maciejsobczak.com/prog/snippets.html
>
>(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)
>
>Cheers,
>
>Maciej Sobczak
>http://www.maciejsobczak.com/
>
>_______________________________________________
>Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Victor A. Wagner Jr. http://rudbek.com
PGP RSA fingerprint = 4D20 EBF6 0101 B069 3817 8DBF C846 E47A
PGP D-H fingerprint = 98BC 65E3 1A19 43EC 3908 65B9 F755 E6F4 63BB 9D93
The five most dangerous words in the English language:
               "There oughta be a law"


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk