4 ms·
>The header only fad seems to because of a lack of one? IIRC they're more costly compilation wise too. Templates cannot be compiled. They have to necesserily b
by yupyupyups 2y ago
>The header only fad seems to because of a lack of one? IIRC they're more costly compilation wise too.
Templates cannot be compiled. They have to necesserily be distributed as header files. Furthermore, header files, unlike compiled code are easier to support on a wider variaty of platforms.
They are more constly to include, as you said.
You could technically create concrete classes or functions from the templates by supplying all the necessary type arguments, and compile that. But then the developer using your library will only be able to "use the template" with those particular type arguments. The flexibility that the templates offer is removed.