On Monday, 18 March 2024 at 08:50:42 UTC, rkompass wrote:
Given the types S and T in say `templfunc(S, T)(S arg1, T arg2) {}` represent 2 different actual types in the program, does that mean that there are 4 versions of the `templfunc` function compiled in? (This was the C++ way iirc).

IMHO, only if you instantiate (make call) templfunc with all types.


Or are the types T and S are put on the stack like ordinary arguments and the usage of arg1 and arg2 within the function is enveloped in switches that query these Types?

IMHO, only if you instantiate (make call) templfunc, then compiler create function with specified types.
Function created only once for given types combination.

Reply via email to