Check if a variadic argument is numeric?

Hamborg via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jul 6 05:15:56 PDT 2017


On Thursday, 6 July 2017 at 08:35:05 UTC, Andrea Fontana wrote:
> On Thursday, 6 July 2017 at 08:22:44 UTC, Hamborg wrote:
>
>> But how would I check _arguments[i]?
>>
>> When I do (isNumeric!_arguments[i]) I get an error saying:
>> "Error: template instance isNumeric!(_arguments) does not 
>> match template declaration isNumeric(T)"
>>
>> or when I do (isNumeric!(_arguments[i])) I get this error:
>> "Error: variable _arguments cannot be read at compile time"
>
> Try with:
> isNumeric!(typeof(_arguments[i]));
>
> Andrea

That compiles, but it returns false when I pass in a numeric 
value... :(


More information about the Digitalmars-d-learn mailing list