Boost logo

Boost Users :

Subject: Re: [Boost-users] reference to '_1' is ambiguous
From: Peter Dimov (pdimov_at_[hidden])
Date: 2009-03-18 17:33:21


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.

Our tests don't show the problem since they don't use 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.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net