fraillt/bitsery

Is there a way to detect (on runtime or compiletime), if the given size is too smal to fit the value?

Febbe opened this issue · 3 comments

Febbe commented
Is there a way to detect (on runtime or compiletime), if the given size is too smal to fit the value?

I don't understand the question...
.... if the given size (size of what?) is too small to fit the value (what value?)?

Febbe commented

I meant, if there are any debug capabilities to check, if the specified size for an exported value is too small to fit the actual/original value?

If I understand you correctly, you are looking for MeasureSize adapter.
It works exactly the same as the output adapter.
You can use it like this:

#include <bitsery/adapter/measure_size.h>
...
auto writtenSize = bitsery::quickSerialization(bitsery::MeasureSize{}, data);