Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-04-27 19:40:13


Eric Niebler wrote:
> Peter Dimov wrote:
>> Eric Niebler wrote:
>>
>>> Although I don't know all the details of bind and lambda, I had
>>> hoped that _1 and _2 would be abstract proto entities, such that
>>>
>>> _1 == _2
>>>
>>> creates an expression template like:
>>>
>>> equal< terminal< arg<1> >, terminal< arg<2> > >
>>>
>>> which is a generic, abstract representation of an equals expression
>>> with two placeholders. Can't bind and lambda both be implemented to
>>> recognize such a type and do the appropriate thing with it?
>>
>> Possibly, if they are made to honor is_bind_expression
>> specializations and result_of, if is_bind_expression reports true
>> for the above type, if the above is a function object that actually
>> returns x == y, and if result_of works for it.
>
> Yes, that can all be made to work without much difficulty.

The part about boost::bind using is_bind_expression and result_of cannot,
not without major surgery and possibly compromising portability.

Sometimes I get excited about the new C++0x features and tell myself, why
not rewrite boost::bind to take advantage of them? Then it occurs to me that
C++0x has a std::bind built-in. :-) (Happened twice so far.)


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