Fallback 'catch-all' template functions
Manu via Digitalmars-d
digitalmars-d at puremagic.com
Fri Sep 2 17:41:17 PDT 2016
On 3 September 2016 at 00:18, Xinok via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> In the past, I have suggested using the "default" keyword to specify a
> fallback function of this kind. I think it's a useful pattern for generic
> algorithms that have optimized variants on specific types for performance.
>
> void f(T)(T t) if(isSomething!T) {}
> void f(T)(T t) if(isSomethingElse!T) {}
> void f(T)(T t) default {}
It's an interesting idea... flesh out a DIP?
More information about the Digitalmars-d
mailing list