Boost logo

Boost :

From: Steven Watanabe (steven_at_[hidden])
Date: 2007-03-03 21:40:43


AMDG

Manuel Fiorelli <manuel.fiorelli <at> gmail.com> writes:

> I know that standard C++ prohibits template parameters and typedefs in
> friend declarations, thus the only way to eliminate the problem seems to use
> an ad-hoc non_derivable helper for each class, but this should require a
> less clean approach:

Even though it is prohibited most compilers allow
it. You might want to look at
http://boost-consulting.com/vault/index.php?&direction=0&order=&directory=Generic%20Programming

> - Can someone say me what is the reason to use a nested
> namespace....what does it mean "unintended ADL"

namespace boost {
    template<class T0>
    void f(const T0&);
}

namespace my_namespace {

    class A {};

    class B : BOOST_NON_DERIVABLE, public A {};

    void f(const A&);

    void f() {
        B b;
        f(b); //calls boost::f
    }

}

In Christ,
Steven Watanabe


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