I am using Flatbuffers with C++. I would like to create an array of bytes in a struct that is the size of the generated table (I am sending the contents as a payload for a NanoMSG message).
How does one do a sizeof(table)?
#include "pnt_generated.h"
struct packetStruct {
Topics topic;
int payloadSize;
uint8_t payload[sizeof(pnt)];
};
does not work directly.
Since it seems that Flatbuffers dynamically sets the size (in my case of the payload). And no one has a better idea, I am creating a fix sized payload in the struct, and then checking to see if I exceed that:
#define PayloadMax 256
#include "pnt_generated.h"
struct packetStruct {
Topics topic;
int payloadSize;
uint8_t payload[PayloadMax];
};