Boost logo

Boost :

From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2006-05-09 21:28:10


"David Abrahams" <dave_at_[hidden]> wrote

> "Arkadiy Vertleyb" <vertleyb_at_[hidden]> writes:
>
> > "David Abrahams" <dave_at_[hidden]> wrote
> >
> >> I can't ask my
> >> library's users to register types.
> >
> > Don't you have to ask them to do something else, so that result_of
works?
>
> No, we'd implement the necessary type computations to make result_of
> work. Remember, result_of takes types as inputs, not objects.
>
> So,
>
> result_of<bind_(std::minus<int>, int, _1_)>::type
>
> just requires that bind_ know about the types produced by boost::bind.
> And in
>
> result_of<minus_(int, _1_)>::type
>
> minus_ would just have to know how the operator- in the lambda library
> works.

I see.

However BOOST_TYPEOF, although does require user type registration, has an
advantage of much nicer syntax. Compare:

result_of<minus_(minus_(int, _1_), _2_)>::type f = 3 - _1 - _2;

with

BOOST_AUTO(f, 3 - _1 - _2);

It would be very nice to have lambda and bind types registered, so that the
user at least have a choise.

Regards,
Arkadiy


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