Boost logo

Boost :

From: Martin Bonner (Martin.Bonner_at_[hidden])
Date: 2007-07-09 03:46:11


From: Dean Michael Berris

> 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_.
>
> I've been successful with using extern placeholders in GCC, and during
> link time I don't encounter the errors which I encounter with MSVC. I
> now need to find a way of doing this another way.

I assume current declarations like:
        extern to_upper_t to_upper_;
        extern headers_t headers_;
        template<T1,T2> transform(T1 t1, T2 t2);

- The simple one is:
        m << transform<to_upper_t,headers_t>();

- You could add a CPP where you define all the externals.

There must be other options.

-- 
Martin Bonner
Project Leader
PI SHURLOK LTD
Telephone: +44 1223 441434 / 203894 (direct)
Fax: +44 1223 203999
Email: martin.bonner_at_[hidden]
www.pi-shurlok.com
disclaimer

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