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


Groups > comp.lang.c++ > #11213

Re: ADL fails for friend functions...

From Victor Bazarov <v.bazarov@comcast.invalid>
Newsgroups comp.lang.c++
Subject Re: ADL fails for friend functions...
Date 2011-11-02 12:34 -0400
Organization A noiseless patient Spider
Message-ID <j8rreq$toi$1@dont-email.me> (permalink)
References <22b4a754-8c28-494a-ba95-bcbb7bccdc57@u24g2000pru.googlegroups.com> <j8rh64$8b6$1@node2.news.atman.pl> <1fcc24a5-ebf6-430e-93d7-de1ae1ab289d@a12g2000prb.googlegroups.com>

Show all headers | View raw


On 11/2/2011 10:28 AM, Werner wrote:
>[..]
> namespace n1{
> class X1
> {
>    friend void join( X1&, X1&  ){ }
> };
> }
> [..]
> I've deliberately not defined the friend outside. The question
> still stands - can you call join in any other way than by
> removing Y's join from the overload set?

This rule comes to mind: the name of a friend function defined in the 
class definition shall *not* be inserted into the namespace scope. 
Don't remember where in the Standard it is, or whether it has changed 
over the years...  But for some reason I seem to remember that it 
exists, and think that it applies here.

V
-- 
I do not respond to top-posted replies, please don't ask

Back to comp.lang.c++ | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

ADL fails for friend functions... Werner <werasm@gmail.com> - 2011-11-02 06:23 -0700
  Re: ADL fails for friend functions... Edek <edek.pienkowski@gmail.com> - 2011-11-02 14:40 +0100
    Re: ADL fails for friend functions... Werner <werasm@gmail.com> - 2011-11-02 07:28 -0700
      Re: ADL fails for friend functions... Edek <edek.pienkowski@gmail.com> - 2011-11-02 16:08 +0100
      Re: ADL fails for friend functions... Victor Bazarov <v.bazarov@comcast.invalid> - 2011-11-02 12:34 -0400

csiph-web