Getting a working example of opIndexAssign using opSlice ... have troubles ...

Tejas notrealemail at gmail.com
Mon Aug 16 06:55:20 UTC 2021


On Monday, 16 August 2021 at 06:49:08 UTC, james.p.leblanc wrote:
> On Monday, 16 August 2021 at 06:42:48 UTC, Tejas wrote:
>
>> If the code works, what's the problem?
>
> Hej Again,
>
> I was able to construct the working code shown above from help I
> obtained here in the forum and other resources.
>
> My original code was not working ... but updated code is working
> fine ... so there are no further problems.  (Actually, I learned
> a fair amount in this endeavor!)
>
> Cheers!
> jpl

Cool

Just for completeness,  here's what my solution looks like:
```d
import std;

struct S{
     char[] a=['a','v','d'];
     T opCast(T)(){
         return a.dup ;
     }
}
void main()
{
     writeln("Hello D");
     S s = S();
     char[] d = cast(char[])s;
}
```


More information about the Digitalmars-d-learn mailing list