opCast / operator overloading with additional template arguments

Paul paultjeadriaanse at gmail.com
Mon Jan 11 03:27:27 UTC 2021


On Monday, 11 January 2021 at 02:37:24 UTC, Ali Çehreli wrote:
> >>     T opCast(T)() const if (is(T : Vec!(size, S2), S2)) {

> The is expression can be so complicated that I used a different 
> approach below.

>   if (isInstanceOfVec!T &&
>       T.init.content.length == size) {
>     // ADDED:
>     alias S2 = typeof(T.init.content[0]);

Is it ok to use .init even though we don't need an instantiated 
value?


More information about the Digitalmars-d-learn mailing list