On Tue, 27 Jan 2015 21:55:37 +0000, bioinfornatics wrote:
> On Tuesday, 27 January 2015 at 21:00:16 UTC, Justin Whear wrote:
>> On Tue, 27 Jan 2015 20:46:59 +0000, bioinfornatics wrote:
>>
>>> void main(){
>>> auto a = Alpha!(int)( 6);
>>> auto b = Alpha!(string)( "hello");
>>
>> The Alpha struct is not a template, only the constructor is.
>> Remove the explicit instantiations and IFTI does the work:
>>> void main(){
>>> auto a = Alpha( 6);
>>> auto b = Alpha( "hello");
>
> Oh really cool
or this:
import std.variant;
struct Alpha {
Variant something;
this(T) (T v) {
something = cast(Variant)v;
}
}
void main () {
Alpha a = 6;
Alpha b = "hello";
}
signature.asc
Description: PGP signature
