Rename std.string.toStringz?
Kagamin
spam at here.lot
Fri Jun 17 06:16:13 PDT 2011
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 ...
}
More information about the Digitalmars-d
mailing list