Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-09-27 08:06:25


David Abrahams wrote:

>> Well, I can tell one third of the story. The reverse_iter_fold.hpp has
>> this:
>>
>> namespace boost { namespace mpl {
>>
>> template<
>> typename BOOST_MPL_AUX_NA_PARAM(Sequence)
>> , typename BOOST_MPL_AUX_NA_PARAM(State)
>> , typename BOOST_MPL_AUX_NA_PARAM(BackwardOp)
>> , typename ForwardOp = arg<1>
>>
>> According to the error message, gcc associates 'arg<1>' with boost::arg
>> (from bind/arg.hpp), while most likely mpl::arg<1> was meant. Two
>> remaining questions are
>> - why gcc does that.
>
> GCC applies "ADL" to almost everything. It's ridiculous.

Do you know if there is bug report about this? I could not find any in gcc's
bugzilla. Besides, I'm not sure gcc is at fault. Here's a completely
distilled testcase:

   namespace boost
   {
       template<int I> class arg {};
   }

   namespace mpl_
   {
       template< int N > struct arg {};
   }

    namespace boost { namespace mpl {

        using namespace mpl_;

        template<typename ForwardOp = arg<1> >
        struct XXX
        {

IIRC, the 'arg' visible via using is considered to be declared in the
nearest namespace enclosing both mpl_ and boost::mpl -- which is global
namespace. So boost::arg hides mpl_::arg. For explicit mpl::aux, the name
lookup ignores the 'boost' namespace.

- Volodya


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