diff options
author | 2015-08-28 14:35:49 -0700 | |
---|---|---|
committer | 2015-08-28 14:35:49 -0700 | |
commit | bff9cf52ed6407862ce96ddfdcd8e97e56cdc520 (patch) | |
tree | adcefb4d7740776b4e44a57336308c31dc0ef099 /src/cpp/util/string_ref.cc | |
parent | 6afe53f2360a20a4d3abda60cfdde576c29b9857 (diff) | |
parent | 808e5ae95f2fba44d2da925e8da0eaa5ce5c6585 (diff) |
Merge branch 'master' into tracing_api
Diffstat (limited to 'src/cpp/util/string_ref.cc')
-rw-r--r-- | src/cpp/util/string_ref.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/cpp/util/string_ref.cc b/src/cpp/util/string_ref.cc index 8483e8c2ee..9adc092013 100644 --- a/src/cpp/util/string_ref.cc +++ b/src/cpp/util/string_ref.cc @@ -39,7 +39,7 @@ namespace grpc { -constexpr size_t string_ref::npos; +const size_t string_ref::npos; string_ref& string_ref::operator=(const string_ref& rhs) { data_ = rhs.data_; @@ -80,7 +80,7 @@ size_t string_ref::find(string_ref s) const { } size_t string_ref::find(char c) const { - auto it = std::find_if(cbegin(), cend(), [c](char cc) { return cc == c; }); + auto it = std::find(cbegin(), cend(), c); return it == cend() ? npos : std::distance(cbegin(), it); } @@ -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 |