I'm trying to make a simple unit / component systems in C ++ base on the other answers to this question: < / P>
Now, I have a static std :: map that gives (and even automatically makes it possible if possible).
I think that he is as follows:
Status component * pos = systems [PositionComponent] .instances [myEntityID]; What would be the best way to get it?
Maybe this?
std :: map & lt; Std :: type_info *, some & gt; System; Then you can do this:
some sth = systems [& amp; Typeid (PositionComponent)]; Just out of curiosity, I checked the codex code of this C ++ code
#include & lt; Typeinfo & gt; # Include & lt; Cstdio & gt; Square fu {virtual} fu () {}}; Int main () {printf ("% p \ n", & amp; Tipid (Foo)); } In order to ensure that it actually Assembler (shortlisted were a constant output by GCC):
.globl _main _main: LFB27: Pusel% EBP Elsifai: movl% esp,% ebp LCFI1: Puslle% ebx LCFI2: subl $ 20,% ASP Elsif 3: Call L3 "L 00,000,000,001 $ PB": L3: Popl% Ibiaks Leila Eldiajitii 3 Fu $ Gar_lajhi_pratik- "L 200000000001 $ PB" (% Ibiaks),% ax MLL% (EX),% ax Melelaks EX, 4% (ASP) leaks Elsi0- "L -00,000,000,001 $ PB" (% Ibiac )% AX MPL% EX,% (SSP) calls _printf MLL $ 0,% Aaksadel $ 20% Speepblop% Ibiaks release writ So it really L__ZTI3Foo $ non_lazy_ptr in Icons (I'm surprised that it is not static - maybe with other compiler options or with other compilers, this is to read). So a steady bit can be a bit faster (if the compiler aggregates time then sees continuously) because you read.
Comments
Post a Comment