Namespaces
Variants
Actions

Talk:cpp/language/adl

From cppreference.com

I would like to point out that in this description it seems that ADL lookup is performed in both *associated classes* and *associated namespaces*, while it is not so: final lookup is performed only in *associated namespaces*, discarding the set of associated classes ( whose only purpose was recursively elarging the set of namespaces involved ).

See 3.4.2, clause 3: [Quote] Let X be the lookup set produced by unqualified lookup (3.4.1) and let Y be the lookup set produced by argument dependent lookup (defined as follows). If X contains — a declaration of a class member, or — a block-scope function declaration that is not a using-declaration, or — a declaration that is neither a function or a function template then Y is empty. Otherwise Y is the set of declarations found in the namespaces associated with the argument types as described below. The set of declarations found by the lookup of the name is the union of X and Y [End quote] Davide.dellaquila (talk) 14:40, 23 August 2014 (PDT) Davide Dell' Aquila

That seems like a reasonable problem. Would you like to take a crack at improving the wording on this page to make it more clear that lookups are in namespaces only? --Nate (talk) 20:58, 24 August 2014 (PDT)


I had to solve the subleties of friend functions in associated classes that didn't fit my first idea. I'm happy with the wording now Davide.dellaquila

[edit] missing a rule when merging the resulted set

In the text, "The set of declarations found by ordinary unqualified lookup and the set of declarations found in all elements of the associated set produced by ADL, are merged, with the following special rules"

there's a missing rule:

typedef names are ignored too. because in [basic.lookup.argdep], the standard said "Typedef names and using-declarations used to specify the types do not contribute to this set. "

Retrieved from "https://en.cppreference.com/mwiki/index.php?title=Talk:cpp/language/adl&oldid=137139"

AltStyle によって変換されたページ (->オリジナル) /