A technique for reducing C++ template bloat by identifying and factoring out the portions of a function that don't depend on the template type, consolidating them into shared, non-templated code to cut down on duplicated compiled output.
Questions this post answers
How do I reduce code bloat caused by C++ templates?
Factor out the parts of a templated function that do not actually depend on the template type parameter into a separate, non-templated function or base class. Since the compiler generates a full copy of a template's code for each distinct type it is instantiated with, isolating the type-independent logic into shared code lets multiple instantiations reuse a single compiled copy instead of duplicating it. Developers hunting for ways to shrink binary size from heavy template use can track C++ optimization techniques on daily.dev.