BinaryRange.copy constructor

BinaryRange.copy(
  1. BinaryRange original
)

Creates a new binary range with the same values as another binary range.

The two ranges can then be used to process the bytes independently of each other. That is, they maintain separate begin offsets.

This does not make a copy of the bytes that are referenced. Both ranges still share the same underlying bytes, so the bytes should not be modified until both ranges are no longer needed.

Implementation

BinaryRange.copy(BinaryRange original)
    : _bytes = original._bytes,
      _begin = original._begin,
      _end = original._end;