diff options
Diffstat (limited to 'src/string_piece.h')
-rw-r--r-- | src/string_piece.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/string_piece.h b/src/string_piece.h index b1bf105..353b24e 100644 --- a/src/string_piece.h +++ b/src/string_piece.h @@ -25,6 +25,8 @@ using namespace std; /// externally. It is useful for reducing the number of std::strings /// we need to allocate. struct StringPiece { + typedef const char* const_iterator; + StringPiece() : str_(NULL), len_(0) {} /// The constructors intentionally allow for implicit conversions. @@ -46,6 +48,14 @@ struct StringPiece { return len_ ? string(str_, len_) : string(); } + const_iterator begin() const { + return str_; + } + + const_iterator end() const { + return str_ + len_; + } + const char* str_; size_t len_; }; |