arangodb / velocypack

A fast and compact format for serialization and storage
Other
420 stars 40 forks source link

UnpackTuple modifications #87

Closed maierlars closed 3 years ago

maierlars commented 3 years ago

This is a small modification to the unpackTuple API. When using unpackTuple on a slice, the underlying array is expected to have exactly the length of the tuple. Otherwise the new error code BadTupleSize is thrown. For ArrayIterators the function was renamed to unpackPrefixAsTuple to indicate that it behaves differently. This function will forward the iterator and read the given number of elements and does not expect the iterator to be at the end position after everything was read. If you want to extract a prefix from a slice use ArrayIterator(slice).unpackPrefixAsTuple<...>() instead.

To allow unpacking of nested tuples, e.g. slice.unpack<int, std::tuple<int, int>, std::string>() an Extractor for tuples was added.

coveralls commented 3 years ago

Coverage Status

Coverage increased (+0.02%) to 96.437% when pulling 458e3fc63efbb287c89f6615b79f8a817c08c0d4 on future/unpack-tuple-mod into 6152214dab8dc54bfc0643c03b1b24d8f58cf52a on main.