-
-
Notifications
You must be signed in to change notification settings - Fork 741
Fixup [un|minimally]InitializedArray #1498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This is good to go, except it needs a rebase. Very nice tricks w.r.t. the size_t static map, may I add! |
Rebased. I actually had to change it a little, I hit some "interesting" bugs. First: I realized that you can't CTFE if the struct has both disabled init and postblit. So yeah, ready for review too. |
Ping @AndrejMitrovic . |
Initialization is guaranteed only for pointers, references and slices, | ||
for preservation of memory safety. | ||
*/ | ||
auto minimallyInitializedArray(T, I...)(I sizes) @trusted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since @trusted
is gone could this break any code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, yes it could. I need to put it back in.
LGTM other than the |
Ping me when it's updated and I'll mark it as automerge, thanks. |
Solves: * http://d.puremagic.com/issues/show_bug.cgi?id=9803 : minimallyInitializedArray fails past "1D" depth * http://d.puremagic.com/issues/show_bug.cgi?id=10637 : minimallyInitializedArray: postblit on non-initialized * http://d.puremagic.com/issues/show_bug.cgi?id=10847 : uninitializedArray accepts arguments which make it fail internally Improvements also include: * Documented as nothrow, and weakly pure. * Works with 0 args (returns an empty slice). * All args are pre-emptivelly changed to size_t, to avoid template over-instantiation.
I had originally removed it, because I had written a version of So I put the trusted back in. I may come back and fix the inference in a later pull. |
Auto-merge toggled on |
Fixup [un|minimally]InitializedArray
Thanks for the work @monarchdodra! |
Third try. I decided to concentrate on fixing/improving the simple things. It's time these get fixed
Solves:
Improvements also include these simple improvements:
Also, arguably, I think the new implementation is easier to handle, since it clearly separates 1 arg and several arg paths.