Commit e9ee87a6 authored by Rafael Sagula's avatar Rafael Sagula Committed by Tudor Bosman

adding StringPiece constructor that takes a piece of another StringPiece

Summary:
adding what seems to be a missing constructor to StringPiece --
I need to be able to take a piece of another StringPiece. (It's possible
to do that with all sorts of strings already, except StringPiece...)

Test Plan: na -- tested as part of other (dependent) diffs

Reviewed By: delong.j@fb.com

FB internal diff: D508545
parent 4138e84a
......@@ -160,6 +160,13 @@ public:
b_ = str.data() + startFrom;
e_ = b_ + size;
}
Range(const Range<Iter>& str,
size_t startFrom,
size_t size) {
CHECK_LE(startFrom + size, str.size());
b_ = str.b_ + startFrom;
e_ = b_ + size;
}
// Works only for Range<const char*>
/* implicit */ Range(const fbstring& str)
: b_(str.data()), e_(b_ + str.size()) { }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment