On Monday, 16 August 2021 at 06:20:11 UTC, Tejas wrote:

Maybe just write `T[]` in code rather than making it happen via the colon?

I also have similar troubles, removing the default value always helped me.

Can you show the code where you're trying to apply this?

Hej Tejas,

Sure, here is the code snippet, it resides within a struct
along with various operator overloads.

To be honest, I am not exactly sure what is happening here. I
am unfamiliar with the "(T : T[])" syntax ... need to read
up a bit on that. (However, not so eary searching for a ":")

BR,
jpl


// --- cast overloading -------------------------------------------
// T[] opCast(T : T[])(){     // this works
T[] opCast(T[])(){ // yields: "Error: identifier expected for template value param"
      T[] x;
      x.length = this.length;
      for( int i = 0 ; i< this.length ; i++){
         x[i] = this.ptr[i];
      }
      return x;
   }



Reply via email to