Problem Description
For efficient de-/serialization one needs the data to be stored in contiguous memory.
Proposed Solution
A type which can act as a dynamically resizable output range.
Possible Alternative Approaches
The standard library provides std::vector and std::array. While the former fits our requirements semantically it always heap allocates and initializes the storage which kills the performance for small inputs/large outputs respectively. The latter doesn't support dynamic resizing.
boost provides boost::container::small_vector<> and boost::container::static_vector<> which can be used, but carry quite the dependency chain. Also note that these are more general and can accomodate types which don't satisfy std::is_trivially_copyable. Sadly this drags in a lot of extra machinery sometimes inhibiting the optimizer.
Additional Context
❎
Problem Description
For efficient de-/serialization one needs the data to be stored in contiguous memory.
Proposed Solution
A type which can act as a dynamically resizable output range.
Possible Alternative Approaches
The standard library provides
std::vectorandstd::array. While the former fits our requirements semantically it always heap allocates and initializes the storage which kills the performance for small inputs/large outputs respectively. The latter doesn't support dynamic resizing.boost provides
boost::container::small_vector<>andboost::container::static_vector<>which can be used, but carry quite the dependency chain. Also note that these are more general and can accomodate types which don't satisfystd::is_trivially_copyable. Sadly this drags in a lot of extra machinery sometimes inhibiting the optimizer.Additional Context
❎