Casting by assigning to the right ...
Paul Backus
snarwin at gmail.com
Tue Apr 14 14:50:29 UTC 2020
On Tuesday, 14 April 2020 at 05:56:39 UTC, Manfred Nowak wrote:
> ```
> i= cast( int) s;
> ```
>
> I do not like to always correctly examine the type of the
> variable I am assigning to ( `i' in this case) for using that
> type in the `cast()' and came up with the idea to no more
> assign to the left but to the right:
You can avoid the need to look up the type by using `typeof`:
i = cast(typeof(i)) s;
More information about the Digitalmars-d
mailing list