Pelle:
> struct NotNull(T) if(is(typeof(T.init !is null))) {
Is this enough?
struct NotNull(T) if (is(T.init is null)) {
> this(T t) {
> enforce(t !is null, "Cannot create NotNull from null");
enforce() is bad, use Design by Contract instead (a precondition with an assert inside).
Bye,
bearophile