I have a vector, which contains structs with boost::variant elements in it.
Now i have to serialize this vector. Because of the specification i have to count the octets, which are needed to save this vector. Now I'm searching for a option to realize this in a easy way.
int allSize = 0;
for(auto it=vec.begin(); it != vec.end(); it++){
//something like size = sizeof(it->variant)
allsize += size;
}
I tried to get the size of the elements with
sizeof(it->variant.type())
but this shows only the size of the variant element (which is the size of the biggest element held from te variant)
So, is there an easy way to get the size of the serialized data? Or do i have to write a visitor with about 7 templates?