Re: Variadic template parameters, refactor a long chain of static if's to 'functions'.

2019-06-28 Thread realhet via Digitalmars-d-learn
On Tuesday, 11 June 2019 at 13:22:26 UTC, Adam D. Ruppe wrote: On Tuesday, 11 June 2019 at 09:26:56 UTC, realhet wrote: static bool processId(bool captureIntId, alias r, alias a)(){ mixin("alias ta = typeof("~a.stringof~");"); As I have been saying a lot, mixin and stringof should

Re: Variadic template parameters, refactor a long chain of static if's to 'functions'.

2019-06-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 11 June 2019 at 09:26:56 UTC, realhet wrote: static bool processId(bool captureIntId, alias r, alias a)(){ mixin("alias ta = typeof("~a.stringof~");"); As I have been saying a lot, mixin and stringof should almost never be used together. You could write this a lot easier:

Variadic template parameters, refactor a long chain of static if's to 'functions'.

2019-06-11 Thread realhet via Digitalmars-d-learn
Hi again, I'm trying to do variadic parameter processing, and I have the following function that works fine: static bool same(T1, T2)(){ pragma(msg, "same? "~T1.stringof~" "~T2.stringof); return is(immutable(T1)==immutable(T2)); } Btn btn(T...)(string params, T args){ enum