Boost logo

Boost Users :

Subject: Re: [Boost-users] reference to '_1' is ambiguous
From: Eric Niebler (eric_at_[hidden])
Date: 2009-03-18 18:07:56

Peter Dimov wrote:
> Eric Niebler:
> ...
>> namespace
>> {
>> // This reference should also be statically initialized
>> placeholder<mpl::int_<1> > const & _1 =
>> placeholder_instance<mpl::int_<1> >::value;
>> }
> This is a problem for some precompiled header implementations.


> Some
> compilers have fixed theirs to allow it, some have not, some only
> allow(ed?) it when the variables are static.

I notice I left "static" out of the example I sent around, but yes,
placeholder_instance<>::value is supposed to be a class static.

> Our tests don't show the problem since they don't use precompiled
> headers.

Step 1: add tests that exhibit the problem with precompiled headers.

> So we've relied on bug reports to iron these out, leading to
> the current status quo in boost/bind/placeholders.hpp.
> Using inline functions:
> static inline boost::arg<1> _1() { return boost::arg<1>(); }
> is the most conservative option since it works everywhere, but it does
> have the disadvantage that one cannot overload operators for _1.

And bind is one of those libraries that we want to work even on ancient
compilers.... <sigh> Maybe we can have a separate Boost.Bind v2 library,
like we now have signals and signals2.

Eric Niebler
BoostPro Computing

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at