Closed glathoud closed 4 years ago
There's a way to select the size of the variable used to encode the length - by default it's ushort
, explaining the limit you encountered. However, it's only usable at the very fine-grained level, I didn't find a good way to expose this API to the cerealise
function. What you can do is mark that array as @NoCereal
, and write a postblit that calls grain
with a different integral type such as size_t
.
Ok thanks, I'll try.
What you can do is mark that array as
@NoCereal
, and write a postblit that callsgrain
with a different integral type such assize_t
.
Hello Atila. I'm having a similar problem to this one. Could you add an example of how to do this postblit with grain
please? Thanks!
@arredondos This is a good example: https://github.com/atilaneves/mqtt/blob/9d64362a9139bec41d76ff4f886c2c716770ae5c/mqttd/message.d#L122
Thanks for the great lib, using it everyday now.
One of my associative arrays went above 65535 elements and I got an overflow error from cerealise, there's code below to reproduce the issue. I noticed the
ushort
s in cerealed's source code and tried somewhat haphazardly to replace them withsize_t
, got it half working but not fully.Would it be thinkable to have an optional type parameter, default
ushort
(as now) ? Or any other solution supporting bigger assoc. arrays ? . overflow use case on assoc. arrays: