language lawyer - C++ name lookup -- -


the standard says (brackets mine)

in cases listed in 3.4.1 [unqualified name lookup], scopes searched declaration in order listed in each of respective categories …

why names kept in sort of ordered list(s)? after all, except function overloading , name hiding, think names unique within namespace.


update address comment:

i expect compiler keep names defined in container such unordered_set per scope , scopes linked in chain.

i wondering why names classified lists per category (which thought variables, typedefs, structure like, functions, templates, etc.) , lists further sorted.

the "order" in case not order of names. order of scopes. in each category scopes listed in order (typically "inside-out": inner scopes outer scopes). order in these scopes searched. typically, first scope contains name in question causes search stop.


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -