[article] Language Design Deal Breakers
Walter Bright
newshound2 at digitalmars.com
Tue May 28 21:15:50 PDT 2013
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;
}
}
More information about the Digitalmars-d
mailing list