Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2000-11-23 12:02:27


From: "Douglas Gregor" <gregod_at_[hidden]>

> > However, if you have a lambda library at
> > your disposal, <functional> becomes obsolete pretty quickly. :-)
>
> I don't think we have the lambda library at our disposal in the common
compiler
> case :(.

Unfortunately.

> > You can't fit 'modern-day' functors into the AdaptableBinaryFunction
model.
> > arg1+arg2 generates something along the lines of
> >
> > struct plus
> > {
> > template<class A1, class A2> typeof(a1+a2) operator()(A1 a1, A2 a2)
> > {
> > return a1+a2;
> > }
> > };
> >
>
> Please excuse my ignorance. Is typeof() en route to standardization?

I hope so. :-) Anyway, I used typeof() only as an illustration... the
real-world functor generated by arg1+arg2 is rather complex. Let me rephrase
this as

struct plus
{
    template<class A1, class A2> plus_traits<A1, A2>::type operator()(A1 a1,
A2 a2)
    {
        return a1+a2;
    }
};

where plus_traits<A1, A2> is defined by a 5k lines of code. :-)

The point is that this functor doesn't have a return_type, a
first_argument_type, or a second_argument_type. It's not an
AdaptableBinaryFunction.

--
Peter Dimov
Multi Media Ltd.

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