Check if a variadic argument is numeric?

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jul 6 00:11:01 PDT 2017


On 07/05/2017 11:26 PM, Hamborg wrote:
> I can test for exactly what what the args are with (_arguments[i] ==
> typeid(int)) but if I just want to know if it's numeric and can pull it
> out as a double what should I do? I don't really want to test for int,
> uint, byte, float, etc individually.

If it exists, it would be in std.traits or __traits. In this case it's 
std.traits.isNumeric. :)

   https://dlang.org/phobos/std_traits.html#isNumeric

Ali



More information about the Digitalmars-d-learn mailing list