Add unchecked versions of advance(), subtract(), and subpiece() in Range
authorGiuseppe Ottaviano <ott@fb.com>
Wed, 28 Sep 2016 22:37:33 +0000 (15:37 -0700)
committerFacebook Github Bot <facebook-github-bot-bot@fb.com>
Wed, 28 Sep 2016 22:38:32 +0000 (15:38 -0700)
commit998f63317f40d92d9e430a1c27ecd687b03c53e3
tree3cd91ff20eef9c58ab80f6bea2c9a023c2c5b2c7
parentc85f38c3cc103038251c41dbabe44866d9ad904a
Add unchecked versions of advance(), subtract(), and subpiece() in Range

Summary:
`Range` has a somewhat inconsistent API: most methods assume
argument validity as a precondition (mirroring their STL
counterparts), others check the arguments and throw for invalid ones.

Since `Range` is intended as a zero-cost abstraction on top of
pointers/iterators, unchecked methods should be preferred. At this
point however we cannot change the semantics of `advance()` and other
methods. This diff adds new unchecked versions of these methods.

Reviewed By: luciang

Differential Revision: D3938480

fbshipit-source-id: 6952683ee0716aa1584e79584158fbf3e083b52e
folly/Range.h
folly/Varint.h