Can / How do you serialize an array using the cereal library .
those.
void save(Archive & ar, const unsigned int version) const
{
unsigned int l = g1_size_bin(g,POINT_COMPRESS);
uint8_t data[l];
memset(data, 0, l);
g1_write_bin(data, l, g,POINT_COMPRESS);
ar(l);
ar(data);
}
This does not work (and I did not expect this either). Does not
ar(cereal::binary_data(data,l));
(which I thought would work, as it looks like the promotion code to be used), which causes a compilation error:
/usr/local/include/cereal/cereal.hpp:79:17: note: candidate template is ignored: replacement failed: changed type 'unsigned char (&) [l]' cannot be used as a template argument BinaryData binary_data (T & data, size_t size)
Does not
ar.saveBinaryValue(data,l);
Since this method is only supported for XML / Json, and I need a binary archive.
source
share