c++ - Static variable initialization over a library -


i working on factory have types added them, however, if class not explicitly instiated in .exe exectured (compile-time), type not added factory. due fact static call how not being made. have suggestions on how fix this? below 5 small files putting lib, .exe call lib. if there suggestions on how can work, or maybe better design pattern, please let me know. here looking for

1) factory can take in types

2) auto registration go in classes .cpp file, , registration code should go in class .cpp (for example below, randomclass.cpp) , no other files.

baseclass.h : http://codepad.org/zgrzvizf

randomclass.h : http://codepad.org/rqiz1atp

randomclass.cpp : http://codepad.org/wqnqdwqd

templatefactory.h : http://codepad.org/94yfusgc

templatefactory.cpp : http://codepad.org/hc2tsfzz

as general rule of thumb, application not include static or global variables library unless implicitly or explicitly used application.

there hundred different ways can refactored. 1 method place static variable inside function, , make sure function called.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -