Implementing Template Restrictions in Different Way

monarch_dodra via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Sep 2 03:22:48 PDT 2014


On Monday, 1 September 2014 at 22:46:52 UTC, Nordlöw wrote:
> Is this a other/newer preferred way to describe the template 
> restriction, using for example __traits(compiles, ...)? Is
>
> is(typeof(...

AFAIK, those produce the same results 99% of the time. The only 
cases where they differ are borderline buggy.

> the fastest way to do this?

Are you talking about constraints, or implementation of 
safeSkipOver?

> BTW: Is there a way to prevent the calls to r1.length and 
> r2.length in this case?

Hum... Are you writing this function because skipOver will 
actually fail? AFAIK, it shouldn't. We should fix skipOver...


More information about the Digitalmars-d-learn mailing list