Within an application, you can instantiate the same template multiple times with the same arguments or with different arguments. If you use the same arguments, the repeated instantiations are redundant. These redundant instantiations increase compilation time, increase the size of the executable, and deliver no benefit.
There are several basic approaches to the problem of redundant instantiations:
Organize your source code so that object files contain fewer instances of each required instantiation and fewer unused instantiations. This is the least usable approach, because you must know where each template is defined and where each template instantiation is required.
Support for explicit instantiation declarations can be enabled by setting the LANGLVL(EXTENDED) or LANGLVL(EXTENDED0X) compiler group suboptions. Explicit instantiation declarations give you the ability to suppress implicit instantiation of templates. This helps reduce the collective size of the object files. It may also reduce the size of the final executable if the suppressed symbol definitions are meant to be found in a shared library, or if the system linker is unable to always remove additional definitions of a symbol. This approach is described in Using explicit instantiation declarations (C++11 only).
The TEMPLATEREGISTRY compiler option provides the benefits of the TEMPINC compiler option but does not require a specific structure for the template header and the template definition file.