On Wednesday, 11 June 2014 at 20:53:21 UTC, Jonathan M Davis via Digitalmars-d-learn wrote:

I don't believe that it's legal to use a cast in an alias declaration, and that's certainly what the error seems to be indicating. Also, using ref in a cast is definitely illegal regardless of where the cast is. ref is not part of a type. The only places that you can use it are function parameters, return types, and foreach variables. If you want to do anything like you seem to be trying to do, you're going to have to alias a function which does the cast for
you rather than try and alias the variable itself.

I also don't see anything here that would work as any kind of multiple alias
this.

- Jonathan M Davis

Thank you, I was assuming D worked as C++ but ref not being part of type is so much better ! (According to Marc Schütz your solution isn't doing so well.)

About alias working with identifier but not with (runtime) expression. Alias should work with compile time expression like map!(x=>2*x) right ? So a static cast should work isn't it ? (though static_cast doesn't exist in D :/)

Reply via email to