How is the TypeInfo assigned?

Tofu Ninja via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Feb 13 04:44:40 PST 2016


Is the TypeInfo given by typeid() guaranteed to be the same for a 
type regardless of where I call it? I guess my question is, is 
the TypeInfo a valid way to dynamically check types?

I am implementing a message passing system for an 
entity-component system, I was planning to use structs as 
messages and use the TypeInfo to determine where they are 
supposed to go. Will this cause any problems?

Also will typeid() allocate? Or is the TypeInfo statically 
allocated at compile time?

Also how does shared libs affect this? Will a TypeInfo passed 
across different libs still match up?

Thanks


More information about the Digitalmars-d-learn mailing list