-dip1000 @safe scope wrapper
vit
vit at vit.vit
Thu Jun 28 13:29:58 UTC 2018
Hello,
Is it possible to create scope wrapper initialized by non default
constructor with scope parameter?
something like this:
struct Wrapper{
int* p;
static Wrapper create(scope return int* p)@safe{
Wrapper w;
w.p = p;
return w;
}
/++ This doesn't work:
this(scope return int* p)@safe scope{
this.p = p;
}+/
}
void main()@safe{
scope int i;
scope Wrapper w1 = Wrapper.create(&i);
scope Wrapper w2 = Wrapper(&i);
}
More information about the Digitalmars-d-learn
mailing list