generic + numeric + literals = abomination
bearophileHUGS at lycos.com
Sat Mar 27 07:44:32 PDT 2010
> When i have the code :
> scalar m = 0.5fp;
> I want compiler to implicitly cast it to typeof(scalar).
> so when the scalar is float, m will be 0.5f.
I am starting to understand, sorry if I am a dumb bear :-) Programming in C++/D is usually much less hard than understanding humans.
I think you mean an universal FP literal that's automatically cast-able to any other floating point type, in template arguments too.
Are you able to write a 10 lines long D program that shows a compile-time error that you don't want to happen? I am willing to fix your code until it shows what you want to show me (assuming it's a real problem in D).
More information about the Digitalmars-d-learn