eyalz800 / zpp_bits

A lightweight C++20 serialization and RPC library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Serialization size estimate?

yuzhichang opened this issue · comments

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?

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

commented

Closing for no activity