Hacker News new | past | comments | ask | show | jobs | submit login

I think you can't do that, because the underscore may start a user defined literal suffix.



D doesn't have a special syntax for user-defined literals, which avoids this problem completely. One can use templates for user-defined literals, such as:

    km!1000
for 1000 kilometers. Here, km is a template that takes an integer argument:

    struct Kilometer { int v; }

    template km(int V) { Kilometer km = Kilometer(V); }




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: