Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-07-07 09:26:45


"JOAQUIN LOPEZ MU?Z" wrote:
> ----- Mensaje original -----
> De: Dean Michael Berris <mikhailberis_at_[hidden]>
> Fecha: Sábado, Julio 7, 2007 9:17 am
> Asunto: Re: [boost] extern placeholders and MSVC 8
> Para: boost_at_[hidden]
>
> [...]
>> As for background, I'm trying to achieve what Boost.Bind does with:
>> boost::bind(&function, _1, _2) -- where _1 and _2 are used mainly as
>> placeholders -- without having to resort to unnamed namespaces
>> (namespace { ... }) to avoid ODR violation. I'm looking at doing
>> something (for the network library I'm working on):
>>
>> network::message m;
>> m << transform(to_upper_, headers_);
>>
>> In the above, to_upper_ and headers_ are placeholders which are used
>> mainly for type deduction -- while transform returns an instance
>> of a type (a functor) with template parameters dependent on the
>> types of to_upper_ and headers_.
>
> If you're using the placeholders exclusively as syntactic tokens,
> then the following ODR-abiding technique can be of use:
>
> http://lists.boost.org/Archives/boost/2006/07/108355.php

enum to_upper_placeholder { to_upper_ };

is easier if you don't mind the conversion to int.

The inline function technique was first suggested to me by Yitzhak Sapir,
FWIW.

http://aspn.activestate.com/ASPN/Mail/Message/boost/1157287


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