Index: base/string_piece.cc |
diff --git a/base/string_piece.cc b/base/string_piece.cc |
index 27f00136c2e3414fbd12342604d68dc0526ffa5e..7a41361bb606b9e8fb6e796b19cba8ca84d4656e 100644 |
--- a/base/string_piece.cc |
+++ b/base/string_piece.cc |
@@ -1,4 +1,4 @@ |
-// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
// Copied from strings/stringpiece.cc with modifications |
@@ -27,6 +27,11 @@ bool operator==(const StringPiece& x, const StringPiece& y) { |
return StringPiece::wordmemcmp(x.data(), y.data(), x.size()) == 0; |
} |
+std::ostream& operator<<(std::ostream& o, const StringPiece& piece) { |
+ o.write(piece.data(), static_cast<std::streamsize>(piece.size())); |
+ return o; |
+} |
+ |
namespace internal { |
void CopyToString(const StringPiece& self, std::string* target) { |
target->assign(!self.empty() ? self.data() : "", self.size()); |