
"JOAQUIN LOPEZ MU?Z" wrote:
----- Mensaje original ----- De: Dean Michael Berris <mikhailberis@gmail.com> Fecha: Sábado, Julio 7, 2007 9:17 am Asunto: Re: [boost] extern placeholders and MSVC 8 Para: boost@lists.boost.org
[...]
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:
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