C++ does not natively support reflection, so doesn't provide such a thing. Some frameworks (e.g. CORBA implementations) do support reflection, but depend on capabilities outside realms of C++ (e.g. automatic code generators) to provide a basis for that. In the end, you probably need to fall back on documentation (e.g. which says "if you add a member to this struct, change the
serialize()
function), trust in other developers to follow that guidance, and possibly administrative controls (code review, etc). —
Peter just now