<div dir="ltr">I'm having a lot of problems with meta when inout gets involved.<div>There's no std.traits that deal with inout, and I think that's a bit of a hole...</div><div><br></div><div>So my situation is, I have X captured by ReturnType!(T.f), and I also have T.</div><div>T.f is "inout(RT)[] f() inout { return ...; }"</div><div><br></div><div>I run into the situation where X == inout(RT)[]. I can't declare variables of that type, and it all goes wrong.</div><div>What I need to do, is transform X into RT[], const(RT)[] or immutable(RT)[] accordingly to T.</div><div><br></div><div>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.</div><div>After that, I need to perform the substitution, and that's proving to be really tricky...</div><div><br></div><div>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...</div><div><br></div><div>Can anyone suggest how I might write that template? I can't work it out >_<</div></div>