|
Boost : |
From: Jonathan Turkanis (technews_at_[hidden])
Date: 2005-01-06 18:15:08
Larry Evans wrote:
> On 01/06/2005 02:29 PM, David Abrahams wrote:
>>
>> * ... your ideas here ... :)
>>
>
> I've had some trouble understanding how placeholders and lambda
> expressions work. Specifically, I've wondered why,
> when a template is instantiated with _1, _2, ...,
> that the instantiation doesn't produce some sort of error
> messages.
Forming a lambda expression doesn't cause the component templates to be
instantiated (on a conforming compiler).
> For instance, if the template requires one of
> its arguments to satisfy some requirement, then how could
> _1 or _2 satisfy such a requirement since they couldn't
> know about it? Then I'm wondering about the complexity
> when the lambda is applied to an argument. Wouldn't each
> _1 have to be replaced by the actual argument, and wouldn't
> this require somehow parsing the template expression?
Yes, that's what Dave was talking about in his original message.
In theory the implementation is not difficult; the hard part was thinking of it
in the first place, and then getting it to work on a bunch of broken compilers.
Jonathan
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk