Why does this template constraint not work?
Jonathan M Davis
jmdavisProg at gmx.com
Fri Dec 27 19:24:46 PST 2013
On Saturday, December 28, 2013 02:31:56 Ross Hays wrote:
> Okay figured it out actually. If you are not going to allow
> implicit conversion the appropriate constraint is...
>
> if (is (T == float))
If you want to accept any floating point type but not implicit conversions,
then use std.traits.isFloatingPoint.
> I said it last time I asked about is and I will say it again. It
> is such a weird syntax...
Heh. It works. And if you do a lot with template constraints, you'll get used
to it. The main thing that avoids needing is expressions quite as much is
std.traits, which can simplify many types of template constraints.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list