Dear that do a lot time wehere I not used std.variant. i would like to hide extra cast from user by using a generic ctor

import std.variant;

struct Alpha {
        Variant something;
        
        this(T)(T v){
                something = cast(Variant)v;
        }
        
}

void main(){
        auto a = Alpha!(int)( 6);
        auto b = Alpha!(string)( "hello");
        auto l = new Alpha[](2);
        l[0] = a;
        l[1] = b;
}

but that do not works.

Someone know a trick?

thanks

Reply via email to