From: Tudor Bosman Date: Tue, 15 Apr 2014 16:24:11 +0000 (-0700) Subject: Add non-const operator[] to TypedIOBuf X-Git-Tag: v0.22.0~605 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=0c8631dcba8f9ca23615166c36e9c9c267bf1e5a;p=folly.git Add non-const operator[] to TypedIOBuf Test Plan: used it Reviewed By: lucian@fb.com FB internal diff: D1277063 @override-unit-failures --- diff --git a/folly/io/TypedIOBuf.h b/folly/io/TypedIOBuf.h index 26eccccc..c5ecfc48 100644 --- a/folly/io/TypedIOBuf.h +++ b/folly/io/TypedIOBuf.h @@ -153,6 +153,11 @@ class TypedIOBuf { return data()[idx]; } + T& operator[](ssize_t idx) { + assert(idx >= 0 && idx < length()); + return writableData()[idx]; + } + /** * Append one element. */