|
Boost : |
From: scleary_at_[hidden]
Date: 2003-03-27 10:58:45
> -----Original Message-----
> From: David Abrahams [mailto:dave_at_[hidden]]
>
> scleary_at_[hidden] writes:
>
> > 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);
>
> ??
Sorry, I wasn't very clear. I mean defining a compare_t that could be used
something like:
compare_t<&position::x, &position::y, &position::z>
that would result in a function object type that produced the same behaviour
when given two arguments of type 'position'. (Usable, e.g., as a template
argument to std::set). I don't see any way of supporting that simple of a
syntax, though; the nicest I can see is:
compare_type<position, compare_t<double, &position::x>,
compare_t<double, &position::y>, compare_t<double, &position::z> >
which is pretty hideous. :(
-Steve
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk