[article] Language Design Deal Breakers
Sergei Nosov
sergei.nosov at gmail.com
Wed May 29 00:01:02 PDT 2013
On Wednesday, 29 May 2013 at 04:15:52 UTC, Walter Bright wrote:
> 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;
> }
> }
What would be the NotNull.init.p value then?
More information about the Digitalmars-d
mailing list