On 5/28/2013 7:40 PM, Jesse Phillips wrote:
On Monday, 27 May 2013 at 07:53:05 UTC, Walter Bright wrote:
In D, right now (and especially with the beta) you can use the NotNull template.
Where is this NotNull template? If it was in Phobos I would expect
http://dlang.org/phobos/std_typecons.html
It's not in Phobos yet:
struct NotNull(T) {
T p;
alias p this;
this(T p) {
assert(p != null, "pointer is null");
this.p = p;
}
@disable this();
NotNull opAssign(T p) {
assert(p != null, "assigning null to NotNull");
this.p = p;
return this;
}
}