Boost logo

Boost :

From: JOAQUIN LOPEZ MU?Z (joaquin_at_[hidden])
Date: 2007-07-07 08:57:54


----- 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

On why this technique cannot be used for more advanced placeholders
such as those of Boost.Lambda, see:

http://lists.boost.org/Archives/boost/2007/06/123375.php
http://lists.boost.org/Archives/boost/2007/06/123376.php

HTH,

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


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