Are templated functions always re-constructed?

rempas rempas at tutanota.com
Wed Nov 17 11:12:22 UTC 2021


On Tuesday, 16 November 2021 at 21:30:08 UTC, H. S. Teoh wrote:
>
> Short answer: a template called with the same CT arguments will 
> only be instantiated once, and reused thereafter.
>
> Long answer: the above applies per compilation. If you compile 
> your sources separately, there may be multiple instantiations 
> of the template with the same CT arguments.  However, unless 
> something went wrong, these duplicates will be dropped by the 
> linker.
>
>
> T

Thanks! I mostly care about compilation times rather than 
duplication tbh


More information about the Digitalmars-d-learn mailing list