-
-
Notifications
You must be signed in to change notification settings - Fork 693
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
Use inout for ref returning members in std.container.array #2573
Conversation
What about unittests that call these functions with mutable/immutable arguments? I'd like something to fail if somebody inadvertently removes these |
Ok. I added tests for If there are more functions in other containers I can make them BTW: const Array!int a = [0];
foreach (e; a) {} errors as
because of const qualifier of |
643fb86
to
9028242
Compare
Shouldn't a slice of the |
9028242
to
703305f
Compare
Added |
LGTM, thanks! |
Auto-merge toggled on |
Use inout for ref returning members in std.container.array
assert(a.back == 2); | ||
auto r = a[]; | ||
size_t i; | ||
foreach (e; r) |
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.
I don't think this works when T
in Array!T
has mutable indirection. Unfortunately, constifying opSlice
is not a satisfying solution to this problem.
More constness checks for #2573
Any fix in sight? |
I propose to close this in favour of #2631. |
For motivation see
http://forum.dlang.org/thread/agyeejbrpotpjrecepyl@forum.dlang.org#post-wysehvbsfnezfozsagpl:40forum.dlang.org