Messing with betterC and string type.

Kagamin spam at here.lot
Fri Sep 7 08:26:11 UTC 2018


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);


More information about the Digitalmars-d mailing list