idea for variant improvement

bioinfornatics bioinfornatics at fedoraproject.rog
Wed Nov 30 14:55:43 PST 2011


Le mercredi 30 novembre 2011 à 22:19 +0100, Timon Gehr a écrit :
> On 11/30/2011 07:53 PM, bioinfornatics wrote:
> > Variant is very usefull but a function who take a variant as parameter
> > do not works whithout a cast. but You can assign a value form any type
> > in statement Variant v = 2u.
> > the code below explain well the problem
> > ---------------
> > import std.string;
> > import std.stdio;
> > import std.variant;
> >
> > void func( Variant param ){
> >      writeln( "it works" );
> > }
> >
> > void func2( T )( T param ){
> >      Variant a = cast(Variant) param;
> >      writeln( "it works" );
> > }
> >
> > void main( string[] args ){
> >      Variant a = 2u; // works
> >      func( a );
> >      //func( 2u ); // does not works
> >      func2( 2u );
> > }
> > ----------
> >
> > It will be great if function func work in all case
> >
> 
> Vote here: http://d.puremagic.com/issues/show_bug.cgi?id=7019

yes thanks i will do. And you you do not vote for this feature?



More information about the Digitalmars-d-learn mailing list