On 4/21/16 10:47 AM, Nick Treleaven wrote:
Hi,
There doesn't seem to be something like this in Phobos:
alias Instantiate(alias Template, T...) = Template!T;
Here's an example of why I need it:
alias staticEx(string msg, string file = __FILE__, size_t line =
__LINE__) =
Instantiate!(.staticEx!(Exception, msg), file, line);
template staticEx(T:Throwable, args...)
{
auto staticEx(string file = __FILE__, size_t line = __LINE__)()
...
Full code:
http://dpaste.dzfl.pl/810e55b1acd76
I found std.meta.ApplyLeft but it doesn't seem to work here. I've needed
this before and ended up doing a workaround with a template block and
temporary alias but it might be nice if Phobos had this. Or is there a
simpler solution?
This doesn't work?
alias staticEx(string msg, string file = __FILE__, size_t line =
__LINE__) = staticEx!(Exception, msg).staticEx!(file, line);
I would think something with AliasSeq could come in handy, it's the way
to alias a compile-time list.
-Steve