Encapsulate return value in scoped
Yuxuan Shui via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Jun 11 01:48:21 PDT 2015
Is there a way to encapsulate return value into scoped?
Say I have a function that returns a new object:
X new_x(T t...) {
//Super complex input processing
return new X(something);
}
And I want to encapsulate the result using scoped, is that
possible? Can I just do:
return scoped!X(something).
?
If I understand correctly, the data will be blitted, but the
destructor will be called, so the returned object will be in
invalid state.
More information about the Digitalmars-d-learn
mailing list