code /
re2 /
ea073665db4975772558f58bd431d2afe2428e92 Refactor moving operator<<() for StringPiece under namespace re2.
So it can be found when it is used in another namespace via ADL
(argument-dependent lookup). I.e., before this CL, the following program
won't compile:
$ cat foo.cpp
#include <iostream>
#include "re2/stringpiece.h"
namespace foo {
class SomeClassInFoo;
std::ostream& operator<<(std::ostream& out, const SomeClassInFoo&);
void bar(std::ostream& os, const re2::StringPiece& s) {
os << s;
}
} // namespace foo
$ g++ -c foo.cpp
foo.cpp: In function 'void foo::bar(std::ostream&, const re2::StringPiece&)':
foo.cpp:10:4: error: no match for 'operator<<' (operand types are 'std::ostream {aka std::basic_ostream<char>}' and 'const re2::StringPiece')
os << s;
^
Change-Id: I8b6f92746fd8c8643c624371e67c1384a05916e0
Reviewed-on: https://code-review.googlesource.com/10291
Reviewed-by: Paul Wankadia <junyer@google.com>
2 files changed