On Thursday, 5 July 2018 at 20:29:02 UTC, Steven Schveighoffer
wrote:
On 7/5/18 4:27 PM, Steven Schveighoffer wrote:
template BetterSelect(bool cond, alias temp1, alias temp2,
Args...)
{
import std.meta : Instantiate;
static if(cond)
alias BetterSelect = Instantiate!(temp1, Args);
else
alias BetterSelect = Instantiate!(temp2, Args);
}
ugh, got too cute for my own good :) No need for Instantiate
here:
alias BetterSelect = temp1!Args;
alias BetterSelect = temp2!Args;
-Steve
I find another solution :)
template Try(alias T, Args...)
{
static if( is( T!Args ) )
alias Try = T!Args;
}
alias U = Select!( isPointer!T, Try!( PointerTarget, T ), T );