folly: operator << for MutableStringPiece
authorLucian Grijincu <lucian@fb.com>
Tue, 12 Aug 2014 01:14:21 +0000 (18:14 -0700)
committerSara Golemon <sgolemon@fb.com>
Thu, 14 Aug 2014 18:49:04 +0000 (11:49 -0700)
Test Plan: n.a

Reviewed By: philipp@fb.com

FB internal diff: D1487919

folly/Range.cpp
folly/Range.h

index 6bc0982412e691a6f8b81d6662fe3d70d8f54ad9..97d28b138db58069cf003fa312363a7dbdd38d23 100644 (file)
@@ -37,6 +37,11 @@ std::ostream& operator<<(std::ostream& os, const StringPiece& piece) {
   return os;
 }
 
+std::ostream& operator<<(std::ostream& os, const MutableStringPiece& piece) {
+  os.write(piece.start(), piece.size());
+  return os;
+}
+
 namespace detail {
 
 size_t qfind_first_byte_of_memchr(const StringPiece& haystack,
index 4d7b1bcb9d673450bb450fae85df3308d9f8e8d4..1f8c1782188a473c7a7e1de552cfffa9fc093119 100644 (file)
@@ -804,6 +804,7 @@ typedef Range<const unsigned char*> ByteRange;
 typedef Range<unsigned char*> MutableByteRange;
 
 std::ostream& operator<<(std::ostream& os, const StringPiece& piece);
+std::ostream& operator<<(std::ostream& os, const MutableStringPiece& piece);
 
 /**
  * Templated comparison operators