add operator +, ==, and != to Cursor classes
authorAdam Simpkins <simpkins@fb.com>
Thu, 20 Feb 2014 23:28:50 +0000 (15:28 -0800)
committerDave Watson <davejwatson@fb.com>
Fri, 28 Feb 2014 22:02:43 +0000 (14:02 -0800)
commit29ba8408181362420acb20bcad2a82f22e033d19
treed1abc1992b546c851885d2d0bb025f978d14a91a
parent788c68233cf985a47aa8fb74c018a1f5d65217ca
add operator +, ==, and != to Cursor classes

Summary:
Add operator+, which returns a new Cursor pointing the specified number
of bytes ahead.  Cursor already implemented a += operator.

Also add == and != operators for checking to see if two cursors are
pointing to the same location.  Note that some derived cursor classes do
contain additional state, and we don't consider that state when
comparing for equality.  For instance, two Appenders pointing to the
same location will compare as equal, even if they are configured with
different growth parameters.  It seems like this is the behavior most
users will expect, but let me know if you have concerns about this.

Test Plan: Updated the unit tests to exercise the new operators.

Reviewed By: davejwatson@fb.com

FB internal diff: D1183537
folly/io/Cursor.h
folly/io/test/IOBufCursorTest.cpp