On Friday, 7 September 2018 at 08:26:11 UTC, Kagamin wrote:
On Thursday, 6 September 2018 at 17:09:34 UTC, SrMordred wrote:
void foo(string s) {}
foo("this");
won't compile, since it won't make a String out of that
immutable(char)[] literal without an explicit initialization
of some sort.
//cannot pass argument "this" of type string to parameter
String s
iep, this seems a real problem. ;/
You can sort of have custom literals like in C++
String s(object.string t){ return String(t); }
foo("this".s);
Yes, but you don't really need this function.
struct String
{
this(object.string s){}
}
foo("this".String);
alias s = String; //if you want.
foo("this".s);