string, char[], overloaded functions.

dajones via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Oct 31 16:58:43 PDT 2014


Ok,

void Foo(string name, string value);
void Foo(string name, int value);

then...

char[] buf = "woo".dup;
Foo("bar","woohoo"); // works ok
Foo("bar",buf~"hoo"); // fails, error says cant match params (string, int)

So shouldnt char[] implicity convert to string, and hence match the 
(string,string) parameter list?

is there a better way than doing...

cast(string)(buf~"hoo")

to get it to pick the correct overload?




More information about the Digitalmars-d-learn mailing list