samedi 4 juillet 2020

Dealing with sizeof() array inside of array

My question for today is how to deal with complex structures with sizeof(). I have a structure like this

std::map<Int32, std::unordered_set<std::pair<DescID, Int32>>> objActions;

The problem is i don't know how to find actual size of this variable. If there would be just a map i could just multiply its size by sizeof, but in this particular case i am not really sure what i should multiply with. Is it should be something like

(sizeof(unordered_set<..., ...>) * map.at_some_iterator.size()) + sizeof(map)?

Thanks.

Aucun commentaire:

Enregistrer un commentaire