Fun with inout
Manu via Digitalmars-d
digitalmars-d at puremagic.com
Sat Sep 6 00:42:10 PDT 2014
I'm having a lot of problems with meta when inout gets involved.
There's no std.traits that deal with inout, and I think that's a bit of a
hole...
So my situation is, I have X captured by ReturnType!(T.f), and I also have
T.
T.f is "inout(RT)[] f() inout { return ...; }"
I run into the situation where X == inout(RT)[]. I can't declare variables
of that type, and it all goes wrong.
What I need to do, is transform X into RT[], const(RT)[] or immutable(RT)[]
accordingly to T.
First problem, I can't work out how to detect if X is inout, I can't seem
to craft an is() expression that works, and there's nothing in std.traits.
After that, I need to perform the substitution, and that's proving to be
really tricky...
I think a std template could be created which will transform some type
containing inout with the appropriate mutability level taken from some
other type...
Can anyone suggest how I might write that template? I can't work it out >_<
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20140906/cca2da87/attachment.html>
More information about the Digitalmars-d
mailing list