Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


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

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

Message-ID <120c366c-0b39-4fb9-af32-5bd78d870df1@googlegroups.com> (permalink)
Newsgroups comp.std.c++
From Johannes Gerd Becker <johannes.gerd.becker@googlemail.com>
Subject Re: Shouldn't there be a way to exclude member functions out of name lookup explicitly?
Organization unknown
References <820594f6-b670-4dba-8254-26d352489616@googlegroups.com> <d3ituoF60v2U1@mid.individual.net>
Date 2015-08-21 19:14 -0600

Show all headers | View raw


Am Donnerstag, 20. August 2015 08:20:08 UTC+2 schrieb Richard Smith:
> On 27/07/15 18:22, Johannes Gerd Becker wrote:
>
> Currently, you cannot rely on ADL within a class defining a member
> > function of the same name as the function you would like to be called.
> >
>
> I must admit that my C++ is getting a bit rusty, but this "problem" was
> well-known a decade ago, typically manifesting with std::swap and member
> functions of the name.  The solution then was equally well known, and
> continues to work in C++11/14:
>
>   using std::begin;
>   auto i = begin(c);
>
> Richard
>
>
> --
> [ 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                      ]


That's definitely a very nice solution, which mitigates the problem a lot.

Thank you very much for your most helpful posting.

I still think being able to write

   using .::begin; // use non-member begin found by ADL
   auto i = begin (v);

or

   auto i = .::begin (v);

would be nice, as then I would not have to mention some begin in my code
that is perhaps never used. Yet I do have to admit that the problem now has
become more a cosmetic rather than a serious one.

Best regards,
Johannes


--
[ 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 | 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