I am studying the MT architecture of Geant4, and I cannot understand this note on page 52 of the toolkit developers guide:
Note: A note on content of split classes. Data fields of the split class should have a size that is known at compile time. Thus objects like std::vector cannot be contained in split class data, but pointers to these object can.
I understand the requirement of classes having a known size, but I don’t understand why
std::vector should not fulfill it. The size of
std::vector actually is known and fixed: in most implementations it is simply 24 bytes, i.e. 3 pointers. So one can effectively create a
std::vector<int> *vptr, instantiate it with say 10 elements and then write e.g.
vptr.resize(5). So I’d say that a
G4Splitter<std::vector<int>>, for example, should work without problems, and likely any other
A contains a
std::vector. The only data types that come to my mind that would create trouble are variable-size, C-style arrays, which however are a very bad idea on their own and better avoided at all.
So I don’t understand the meaning of the note. Is my understanding wrong, or is the note wrong? Thanks.