First Draft: Implicit Conversion of Template Instantiations
Timon Gehr
timon.gehr at gmx.ch
Mon Mar 18 01:17:15 UTC 2024
On 3/16/24 16:50, Walter Bright wrote:
> https://github.com/WalterBright/documents/blob/9dba63a4c2887bdb2b988c354ebb0d6bb44c4968/templatecast.md
>
> DConf: https://dconf.org/2024/online/index.html#walterb
Issue: I think the field names also have to match.
Consider:
```d
struct S(bool swapped,T1,T2){
static if(swapped){
T2 second;
T1 first;
}else{
T1 first;
T2 second;
}
}
void main(){
import std.stdio;
auto s1=S!(true,int,int)(1,2);
S!(false,int,int) s2=s1;
writeln(s1.first," ",s1.second); // 1 2
writeln(s2.first," ",s2.second); // 2 1
}
```
More information about the dip.development
mailing list