Convert int[] to custom[]
    SR_team 
    dlang at prime-hack.net
       
    Sat Dec 14 10:41:14 UTC 2019
    
    
  
```
alias custom = Typedef!int;
custom[] arr = [1,2,3];
```
Error: cannot implicitly convert expression [1, 2, 3] of type 
int[] to Typedef!(int, 0, null)[]
```
alias custom = Typedef!int;
custom[] arr = cast(custom[])[1,2,3];
```
Error: cannot cast expression 1 of type int to Typedef!(int, 0, 
null)
Error: cannot cast expression 2 of type int to Typedef!(int, 0, 
null)
Error: cannot cast expression 3 of type int to Typedef!(int, 0, 
null)
Work only this variant:
```
alias custom = Typedef!int;
custom[] arr = [cast(custom)1,cast(custom)2,cast(custom)3];
```
but this crap
    
    
More information about the Digitalmars-d
mailing list