Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.std.c++ > #772

Re: Shouldn't there be a way to exclude member functions out of name lookup explicitly?

Message-ID <ooadndWYEoBTBk7InZ2dnUU78d-dnZ2d@giganews.com> (permalink)
Newsgroups comp.std.c++
From Jakob Bohm <jb-usenet@wisemo.com>
Subject Re: Shouldn't there be a way to exclude member functions out of name lookup explicitly?
Organization WiseMo A/S
References <820594f6-b670-4dba-8254-26d352489616@googlegroups.com> <5e134e90-067e-4d71-bf40-c4396bfc52f4@googlegroups.com> <31d52d8d-796a-4b61-8e56-6da52f2136be@googlegroups.com> <NZKdnQZa84VGn1bInZ2dnUU78dGdnZ2d@giganews.com> <dac23163-d38e-477a-b1b6-ecd99e35ad52@googlegroups.com>
Date 2015-08-18 22:35 -0600

Show all headers | View raw


On 17/08/2015 01:29, Johannes Gerd Becker wrote:

>
> ...
>>>
>>> Why can I write
>>>
>>> using namespace std;
>>> auto i = begin (vec);
>>>
>>> everywhere in my code, yet not within a class that has a member functio=
n
>>> named begin ()?
>>>
>>> ...
>>>
>>
>> Doesn't the existing :: qualifier do this already:
>>
>> auto i == ::begin(vec); // ADL
>>
>> Or did I miss some unfortunate interaction with the way named namespaces
>> were formally added to the language?
>>
>>
> No, it doesn't.
>
> ::begin is considered as a qualified id, and ADL is not done for qualifie=
d
> ids ([basic.lookup.argdep], paragraph 1). ::begin will always only refer =
to
> the global namespace ([basic.lookup.qual], paragraph 4).
>
>
Just to expand your statements for clarity, you seem to be saying two of
the following three things:

1. Qualified ids such as Foo::Bar(7, 'A') and ::Bar(7, 'A') are not
  looked up based on their argument types, thus greatly reducing the
  ability to invoke overloaded functions????

2. Qualified ids such as Foo::Bar(7, 'A') and ::Bar(7, 'A') are not
  searched outside their specified scope/namespace, even if an outer
  scope/namespace provides a more appropriate overloaded function????

3. The Global Scope prefix :: operator also excludes any non-class
  namespaces brought in via the using keyword, including the "std"
  namespace????

#3 is the unfortunate interaction I alluded to in my previous post.

If you are saying just #2 and #3, I am a bit confused what the original
problem was:

A. Unqualified ids such as Bar(7, 'A') are not searched beyond the
  first found scope containing an identifier Bar, even if that
  identifier has the wrong type for its arguments.

B. Unqualified ids such as Bar(7, 'A') are not searched beyond the
  first found scope containing an identifier Bar, even if that
  identifier has the wrong type for its arguments, but only if that
  first found scope is a class declaration.

C. Limitation A or B applies only to some language implementations or
  to some editions of the standard.

In either case, I am still wondering why the exemplified issue cannot be
handled directly with a Qualified Id, specifically which (2 or more) scopes
do you want the template implementation to search for identifier begin().


Enjoy

Jakob
--
Jakob Bohm, CIO, Partner, WiseMo A/S.  https://www.wisemo.com
Transformervej 29, 2860 S=C3=B8borg, Denmark.  Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded


[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]

Back to comp.std.c++ | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Shouldn't there be a way to exclude member functions out of name  lookup explicitly? Johannes Gerd Becker <johannes.gerd.becker@googlemail.com> - 2015-07-27 11:22 -0600
  Shouldn't there be a way to exclude member functions out of name   lookup explicitly? Anton Bikineev <ant.bikineev@googlemail.com> - 2015-07-30 11:54 -0600
    Re: Shouldn't there be a way to exclude member functions out of name    lookup explicitly? Johannes Gerd Becker <johannes.gerd.becker@googlemail.com> - 2015-08-01 21:09 -0600
      Re: Shouldn't there be a way to exclude member functions out of name lookup explicitly? Jakob Bohm <jb-usenet@wisemo.com> - 2015-08-12 13:00 -0600
        Re: Shouldn't there be a way to exclude member functions out of name  lookup explicitly? Johannes Gerd Becker <johannes.gerd.becker@googlemail.com> - 2015-08-16 17:29 -0600
          Re: Shouldn't there be a way to exclude member functions out of name lookup explicitly? Jakob Bohm <jb-usenet@wisemo.com> - 2015-08-18 22:35 -0600
  Re: Shouldn't there be a way to exclude member functions out of name  lookup explicitly? Richard Smith <richard@ex-parrot.com> - 2015-08-20 01:10 -0600
    Re: Shouldn't there be a way to exclude member functions out of name   lookup explicitly? Johannes Gerd Becker <johannes.gerd.becker@googlemail.com> - 2015-08-21 19:14 -0600

csiph-web