std.traits : Select - could it be better?
Steven Schveighoffer
schveiguy at yahoo.com
Thu Jul 5 20:29:02 UTC 2018
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
More information about the Digitalmars-d
mailing list