Skip to content
Snippets Groups Projects
Commit 6501071d authored by Yang Gao's avatar Yang Gao
Browse files

Merge pull request #3079 from ctiller/scrubbing-the-floor

Add ostream support for string_ref
parents afbbaf9c 47ec9a40
No related branches found
No related tags found
No related merge requests found
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#define GRPCXX_STRING_REF_H #define GRPCXX_STRING_REF_H
#include <iterator> #include <iterator>
#include <iosfwd>
#include <grpc++/support/config.h> #include <grpc++/support/config.h>
...@@ -110,6 +111,8 @@ bool operator>(string_ref x, string_ref y); ...@@ -110,6 +111,8 @@ bool operator>(string_ref x, string_ref y);
bool operator<=(string_ref x, string_ref y); bool operator<=(string_ref x, string_ref y);
bool operator>=(string_ref x, string_ref y); bool operator>=(string_ref x, string_ref y);
std::ostream& operator<<(std::ostream& stream, const string_ref& string);
} // namespace grpc } // namespace grpc
#endif // GRPCXX_STRING_REF_H #endif // GRPCXX_STRING_REF_H
......
...@@ -108,4 +108,8 @@ bool operator>=(string_ref x, string_ref y) { ...@@ -108,4 +108,8 @@ bool operator>=(string_ref x, string_ref y) {
return x.compare(y) >= 0; return x.compare(y) >= 0;
} }
std::ostream& operator<<(std::ostream& out, const string_ref& string) {
return out << grpc::string(string.begin(), string.end());
}
} // namespace grpc } // namespace grpc
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment