Rename std.string.toStringz?
Daniel Gibson
metalcaedes at gmail.com
Fri Jun 17 06:13:50 PDT 2011
Am 17.06.2011 15:16, schrieb Kagamin:
> Daniel Gibson Wrote:
>
>> What is to!c_str() supposed to return?
>
> C string obviously.
>
>> To be a useful alternative to toStringz() it needs to be
>>
>> char* to!c_str(string s) (or immutable(char)* or something)
>> i.e. the related toImpl looks like
>> char* toImpl(c_str, string)(string s)
>> => 3 types! (char*, c_str, string)
>>
>> But the signature of toImpl is
>> T toImpl(T, S)(S s)
>> so the related to's signature is
>> T to(T)(S s)
>> or something like that.
>
> I thought, D templates allow specialization, so it should be possible to specialize toImpl for c_str
> like
> auto toImpl(T,S)(S s) if(T==c_str)
> {
> return ...
> }
This would be inconsistent with all other to implementations, as far as
I know.
More information about the Digitalmars-d
mailing list