Serialization size estimate?
yuzhichang opened this issue · comments
Zhichang Yu commented
My usage senario is:
- estimize the serialization size of multple objects
- allocate a large enough buffer
- serialize those objects in sequence
Can zpp_bits add GetSizeInBytes() or something else to estimize the size of serialization of an object?
Eyal Z commented
What you’re asking is reasonable but outside of the design of the library as it is now. std::vector is pretty fast, I wonder why not just go with it and have it resize along the way. Because you control what you serialize you may have a much better way to estimate it and use reserve on your std::vector prior to calling serialize - as the library would have to go over the full data which is slow to have an idea what the size might be
Eyal Z commented
Closing for no activity