Are templated functions always re-constructed?

rempas rempas at tutanota.com
Tue Nov 16 21:14:50 UTC 2021


Let's say that I have the following function:

```
void add(T)(T val, T val2) { return val + val2; } // Classic 
example, lol
```

Now let's say that I call the function passing an `int` 
parameter. The function will get built with an `int` type. What 
happens the second time that I will call it again? Will it get 
the already build function or will it make a new one? I suppose 
it re-uses it but still I wanted to ask just in case. Please only 
answer if you are sure and not be making guesses because it is 
really important! Thanks!


More information about the Digitalmars-d-learn mailing list