-
Notifications
You must be signed in to change notification settings - Fork 37
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
const conversion with labels #469
Comments
Anyway, the consequence of this is that it can be hard to write a function like below that works generically with labels and const T pointers. void foo(T, Labels...)(Slice!(const(T)*, 2u, Contiguous, Labels) a) {} |
The lables almost not implemented. |
Mit uses |
@9il After looking at it for a bit, it is starting to make a bit more sense why you did it this way. The idea is to make the whole thing const, including both values and labels. The only thing that really jumps out is that the And for whatever reason, this doesn't work but would make my life a lot easier if you could You instead have to do something like: void foo(T)(Slice!(const(T)*, 2u, Contiguous) a) {}
void foo(T, Label1)(Slice!(const(T)*, 2u, Contiguous, const(Label1)*) a) {}
void foo(T, Label1, Label2)(Slice!(const(T)*, 2u, Contiguous, const(Label1)*, const(Label2)*) a) {} |
There seems to be some weird behavior when you have a function that takes a slice with a
const(T)*
iterator and try to handle cases with labels. The errors I get as it is is that some of these match multiple functions for reasons that don't quite make sense. I know there's some part of themir_slice
code that converts things to const, but I've never really dug into it to understand how it works.The code below doesn't have errors when you replace the
const(T)*
withT*
. Alternately, if you replace theint*
s withconst(int)*
s, then the errors go away.The text was updated successfully, but these errors were encountered: