If anybody is curious about how templates work, there are many ways, but the two most historically popular are:<p>Prelinker:<p>1. Compile each file, noting which templates are needed in a section in the object file<p>2. Have a special program called the "prelinker" run before the linker that reads each .o file, and then somehow instantiates each template (which usually, but not always requires reparsing the C++ file)<p>Weak Symbols:<p>1. When compiling instantiate every needed template, but mark it somehow in the object file as being weak, so that the linker only pulls in one instantiation for each definition.<p>The prelinker used to be more popular, as if you e.g. instantiate the same template in every single file, your compiler does <i>tons</i> more work with the weak symbols approach, <i>but</i> now weak symbols are popular both because they are <i>much</i> simpler to implement and the fact that compilation is usually parallel, while linker is typically not means that walk clock times may even be faster.