This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Namespace Lookup


Is the following correct C++? If so, why? I.e. why is the operator<<
visible?

TIA,
Martin

class ostream;
extern ostream cout;
namespace foo
{
  struct S
  {
    int i;
  };
  
  extern ostream &operator<<(ostream &, const S &);
}


void bar(foo::S s)
{
  cout << s ;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]