Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-11-30 09:32:24


Howard Hinnant wrote:
> On Nov 30, 2004, at 7:52 AM, David Abrahams wrote:
>
>> Peter Dimov wrote:
>>> David Abrahams wrote:
>>>> Peter Dimov wrote:
>>>>
>>>>> (I had boost::placeholders in mind for a
>>>>> namespace, consistent with std::tr1::placeholders; when you use
>>>>> 'boost' as a substitute for 'std::tr1', boost::bind::placeholders
>>>>> won't work.)
>>>>
>>>>
>>>> Okay, as long as you cooperate with phoenix and lambda, as far as
>>>> I'm concerned.
>>> What specific kind of cooperation do you have in mind?
>>
>> Ideally? You all use the same placeholders.
>
> I've also wondered if a general "placeholder library" is possible.

It's possible to write libraries so that they recognize the same
placeholders, but the existing Bind and Lambda codebases aren't written in
such a way.

However I'd expect Metrowerks's implementation to be able to use Bind's and
Lambda's placeholders; the only thing that is needed is appropriate
specializations of std::tr1::is_placeholder. By specializing
std::tr1::is_bind_expression for boost::_bi::bind_t<R, F, L>, std::tr1::bind
should even be able to recognize a nested boost::bind subexpression.

Daniel Wallin's suggestion of using

#define _1 arg<1>()

which is both a type and a value can enable even type (mpl) and value (bind,
lambda) placeholders to be unified. Of course I can only imagine what the
response to a macro _1 would be from an audience that can't even stand a
global _1.


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