Add ostream support for string_ref

pull/3079/head
Craig Tiller 10 years ago
parent afbbaf9c3e
commit 47ec9a40ad
  1. 3
      include/grpc++/support/string_ref.h
  2. 4
      src/cpp/util/string_ref.cc

@ -35,6 +35,7 @@
#define GRPCXX_STRING_REF_H
#include <iterator>
#include <iosfwd>
#include <grpc++/support/config.h>
@ -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);
std::ostream& operator<<(std::ostream& stream, const string_ref& string);
} // namespace grpc
#endif // GRPCXX_STRING_REF_H

@ -108,4 +108,8 @@ bool operator>=(string_ref x, string_ref y) {
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

Loading…
Cancel
Save