Testing template parameter has given API

NaN divide at by.zero
Sat May 16 08:53:08 UTC 2020


On Saturday, 16 May 2020 at 02:02:47 UTC, Paul Backus wrote:
> On Saturday, 16 May 2020 at 01:11:54 UTC, NaN wrote:
>
> Rather than trying to inspect the function itself, it's easier 
> to check that the result of *calling* the function is what you 
> expect it to be. So, for example:
>
>     is(typeof(T.x(size_t.init)) == FloatType)
>
> The above checks to see whether, when you call T.x with a 
> size_t argument, you get a FloatType back. If you write your 
> checks this way, it doesn't matter whether T.x is a function, a 
> delegate, or even a template.

That fixed it. Thanks.


More information about the Digitalmars-d-learn mailing list