Is it true that template code compiled and linked into a PE will increase in size compared to code without templates. I think each instances of templates used is packed orderly so it will output a match if required faster.
Sorry for the question I just don’t know much about template.
C++ works on the principle:
You pay for what you use.
Template code creates binaries only for the code that you use/Instantiate.
Just because you compile against Standard Library which has hundreds of STL containers it does not mean your object code includes all of them, It only includes the ones you use.
Templates implement compile time polymorphism. An copy of templated function is created for every instantiation you do with different data type, same is the case for templated classes. This code is further compiled to create binaries. So the size of the binary will not be any bigger than what your code without templates would produce.