How to manualy declare constructor for struct Ptr which work like Ptr.create? struct Ptr{ int* ptr; static Ptr create(scope return int* ptr)@safe{ Ptr x; x.ptr = ptr; return x; } /++ This doesn't work: this(scope return int* ptr)scope @safe{ this.ptr = ptr; } +/ } void main()@safe{ int i; auto x = Ptr(&i); auto y = Ptr.create(&i); }