digitalmars.D.learn - idea for variant improvement
- bioinfornatics (23/23) Nov 30 2011 Variant is very usefull but a function who take a variant as parameter
- Timon Gehr (2/25) Nov 30 2011 Vote here: http://d.puremagic.com/issues/show_bug.cgi?id=7019
- bioinfornatics (2/33) Nov 30 2011 yes thanks i will do. And you you do not vote for this feature?
- Timon Gehr (3/36) Nov 30 2011 I already have =).
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 =3D 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 =3D cast(Variant) param;
writeln( "it works" );
}
void main( string[] args ){
Variant a =3D 2u; // works
func( a );
//func( 2u ); // does not works
func2( 2u );
}
----------
It will be great if function func work in all case
Nov 30 2011
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
Nov 30 2011
Le mercredi 30 novembre 2011 =C3=A0 22:19 +0100, Timon Gehr a =C3=A9crit :On 11/30/2011 07:53 PM, bioinfornatics wrote:yes thanks i will do. And you you do not vote for this feature?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 =3D 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 =3D cast(Variant) param; writeln( "it works" ); } void main( string[] args ){ Variant a =3D 2u; // works func( a ); //func( 2u ); // does not works func2( 2u ); } ---------- It will be great if function func work in all case=20 Vote here: http://d.puremagic.com/issues/show_bug.cgi?id=3D7019
Nov 30 2011
On 11/30/2011 11:55 PM, bioinfornatics wrote:Le mercredi 30 novembre 2011 à 22:19 +0100, Timon Gehr a écrit :I already have =). http://d.puremagic.com/issues/votes.cgi?action=show_bug&bug_id=7019On 11/30/2011 07:53 PM, bioinfornatics wrote:yes thanks i will do. And you you do not vote for this feature?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 caseVote here: http://d.puremagic.com/issues/show_bug.cgi?id=7019
Nov 30 2011








Timon Gehr <timon.gehr gmx.ch>