March 16, 2005 mixin ctors causes collisions. | ||||
---|---|---|---|---|
| ||||
import std.stdio; class A { template ctor(Type) { this(Type[] arr) { foreach(Type v; arr) writefln(typeid(typeof(v))); } } //uncomment any one of these... //mixin ctor!(bit); //mixin ctor!(byte); //mixin ctor!(short); mixin ctor!(int); //mixin ctor!(long); } void main() { static int[] ints = [0,1,2,3]; A a = new A(ints); } Regan |
March 22, 2005 Re: mixin ctors causes collisions. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Regan Heath | -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Regan Heath schrieb am Thu, 17 Mar 2005 00:02:14 +1300: > import std.stdio; > > class A { > template ctor(Type) > { > this(Type[] arr) > { > foreach(Type v; arr) writefln(typeid(typeof(v))); > } > } > > //uncomment any one of these... > //mixin ctor!(bit); > //mixin ctor!(byte); > //mixin ctor!(short); > mixin ctor!(int); > //mixin ctor!(long); > } > > void main() > { > static int[] ints = [0,1,2,3]; > A a = new A(ints); > } > > Regan Added to DStress as http://dstress.kuehne.cn/run/mixin_09.d http://dstress.kuehne.cn/run/mixin_10.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCQHmd3w+/yD4P9tIRAqsiAJ9EJRx6P7mLKk0qedITHG5lpeewGgCfUDtV yPxW8ltpc+CeLDNT2b0UqA8= =f7SU -----END PGP SIGNATURE----- |
Copyright © 1999-2021 by the D Language Foundation