How to make a struct containing an associative array to deeply copy (for repeated usage in foreach) ?

rkompass rkompass at gmx.de
Mon Mar 18 08:50:42 UTC 2024


@bachmeier
> You're not the first one. There's no technical reason for the 
> restriction. It's simply a matter of being opposed by those who 
> make these decisions on the basis that it's the wrong way to 
> program or something like that. Here is a recent thread: 
> https://forum.dlang.org/post/ikwphfwevgnsxmdfqqkl@forum.dlang.org

Thank you for this. Very interesting discussion. And apparently a 
deliberate restriction of flexibility in type conversion.

I will first try to understand better how templates work under 
the hood before joining this discussion.

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).
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?



More information about the Digitalmars-d-learn mailing list