simple (I think) eponymous template question ... what is proper idimatic way ?

Dominikus Dittes Scherkl dominikus at scherkl.de
Wed Aug 18 06:21:53 UTC 2021


On Wednesday, 18 August 2021 at 05:33:13 UTC, james.p.leblanc 
wrote:
> If I wanted to ensure that a function accepts only arguments of
> byte, int, uint, long, etc.  (i.e. integer-like types).  Is the 
> accepted way to do this like so?:
>
> **auto foo( T : long )(T a, T b){ ... }**

I very much prefer the ususal constraint syntax

**auto foo(T)(T a, T b) if(isIntegral!T) { ... }**


More information about the Digitalmars-d-learn mailing list