From 0c8631dcba8f9ca23615166c36e9c9c267bf1e5a Mon Sep 17 00:00:00 2001 From: Tudor Bosman Date: Tue, 15 Apr 2014 09:24:11 -0700 Subject: [PATCH] Add non-const operator[] to TypedIOBuf Test Plan: used it Reviewed By: lucian@fb.com FB internal diff: D1277063 @override-unit-failures --- folly/io/TypedIOBuf.h | 5 +++++ 1 file changed, 5 insertions(+) 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. */ -- 2.34.1