Boost logo

Boost Users :

Subject: Re: [Boost-users] [uuid] to string problem
From: John Dlugosz (JDlugosz_at_[hidden])
Date: 2010-05-12 15:19:43


> Providing a function template parameter explicitly will disable ADL.
>

I just looked through N3092, and that is not (no longer?) the case.

        f(x); // uses ADNL
        (f)(x); // suppresses ADNL
        f<int>(x); // still uses ADNL.

§14.2 (temp.names, if you want to try finding the corresponding sections in an older standard) defines 'template-id' such that f<int> is one.

§5.1.1 (expr.prim.general) defines a 'template-id' to be a 'unqualified-id'.

§3.4.2 (basic.lookup.argdep) states

        "When the postfix-expression in a function call (5.2.2) is an unqualified-id, other namespaces not considered during the usual unqualified lookup (3.4.1) may be searched, and in those namespaces, namespace-scope friend function declarations (11.4) not otherwise visible may be found. These modifications to the search depend on the types of the arguments (and for template template arguments, the namespace of the template argument).

I can't access my copy of the official C++98 standard anymore because of stupid DRM stuff in Acrobad Reader, and the paper copy is much harder to grep and has been consigned to a box somewhere for a few years. But maybe someone knows if that has changed and was indeed not the case before, or if the compiler is actually buggy now for not doing it?

So, it is "the future" even if it is not the present. Default arg should still work, so making to_string be a template for different return types should be something that works as well as a single function now, is accessible the hard way if you want a different form, and will work better in the future.


--John




TradeStation Group, Inc. is a publicly-traded holding company (NASDAQ GS: TRAD) of three operating subsidiaries, TradeStation Securities, Inc. (Member NYSE, FINRA, SIPC and NFA), TradeStation Technologies, Inc., a trading software and subscription company, and TradeStation Europe Limited, a United Kingdom, FSA-authorized introducing brokerage firm. None of these companies provides trading or investment advice, recommendations or endorsements of any kind. The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.


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