On Friday, 1 July 2022 at 13:53:28 UTC, Antonio wrote:
On Friday, 1 July 2022 at 13:48:25 UTC, Antonio wrote:
-Why?

I realized Json is an struct (not an object)... and I supose, it is managing null asignation manually (as a way to build Json(null)).

-Whats the correct whay to test if something can be null?

That's my question :-p

Something like this does the job:

```d
enum canBeNull(T) = is(typeof({T t; t = null;}));
static assert(canBeNull!(Object));
static assert(!canBeNull!(int));
```

and that should handle opAssign and opCmp overloads.

Reply via email to