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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] LWG 2989 hide path iostream operators from normal lookup


That's a great way to define global operators.

I started working on making iterator operators global as we said once on this mailing list. I already noticed during that task that when I was making a mistake and gcc was complaining about not finding the == operator it was proposing about 80 candidates, so a very big compiler error message.

Can I generalize this approach ?

François

On 18/06/2018 20:59, Jonathan Wakely wrote:
By only defining these operators as friends (with no namespace-scope
declaration) they can only be found by ADL and do not participate in
overload resolution for arguments of types other than path.

    LWG 2989 hide path iostream operators from normal lookup
    * include/bits/fs_path.h (operator<<, operator>>): Define inline as
    friends.
    * testsuite/27_io/filesystem/path/io/dr2989.cc: New.

Tested powerpc64le-linux, commmitted to trunk.




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