T.zero and T.one for numeric types
Adam D. Ruppe via Digitalmars-d
digitalmars-d at puremagic.com
Fri Apr 17 06:33:35 PDT 2015
On Friday, 17 April 2015 at 13:27:19 UTC, Biotronic wrote:
> void foo(T)(T a) {}
>
> foo!T(0);
Does foo(T(0)); work? It seems like it should
void foo(T)(T a) {}
import std.bigint;
import std.complex;
void main() {
foo(BigInt(0));
foo(float(0));
foo(int(0));
foo(Complex!float(0));
}
as of one of the newish dmds, T(n) works to construct basic types
too.
More information about the Digitalmars-d
mailing list