On Thursday, 17 September 2015 at 17:35:18 UTC, jmh530 wrote:
I noticed that there's some interesting interplay with this technique and default arguments.

Yeah, it expects the V... to consume the rest of the arguments so it doesn't really leave any room for the default arg.

I would actually just make it required or do separate functions with it. Optional and variadics don't mix well together.

(You could also loop through and look for a bool argument yourself but that is a bit messier.)

Also, it doesn't seem to let me put template constraints on V so that I could do something like constrain V to be numeric.

import std.meta;
import std.traits;

if(allSatisfy!(isNumeric, V))

should do it

Reply via email to