Basic question about size_t and ulong

Era Scarecrow rtcvb32 at
Wed Mar 23 01:04:00 UTC 2022

On Wednesday, 23 March 2022 at 00:51:42 UTC, Era Scarecrow wrote:
> On Tuesday, 22 March 2022 at 21:23:43 UTC, H. S. Teoh wrote:
>> We already have this:
>> 	import std.conv : to;
>> 	int x;
>> 	long y;
>> 	y =!long;	// equivalent to straight assignment / cast
>> 	x =!int;	// throws if out of range for int
>  This particular usage can be useful, just not in the 
> *automatic* sense i was meaning.

  Forgot to add this; for the more automatic mode maybe add a new 
tag say @autodowncast, which may add the .to!passingtype leaving 
said checks without needing to throw casts in a dozen places.

  Though i doubt Walter or Andrei would go for it.

More information about the Digitalmars-d-learn mailing list