in c++, i use template class AutoRegisterTemplate to do some automatic registration in class constructor. Suppose ModuleClass is the template parameter, for different ModuleClass , the constructor extract their `ModuleClass::Register` function pointer in a static std::map variable all_register_funcs.   Now i have this problem,  I write `static AutoRegisterTemplate<ModuleClassA> file_local_var` in a .cpp file my_module_a.cpp, hoping ModuleClassA will trigger it's constructor and inturn put ModuleClassA::Register pointer into the `all_register_funcs`. However, when I run the program, the .cpp file my_module_a.cpp was never linked, it seems that this cpp file was optimized away by linker. Is this a template thing? how do i avoid the problem and achive my goal of using the instantiation mechanic of template to do automatic registration.