Printing shortest decimal form of floating point number with Mir

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Thu Dec 24 15:38:23 UTC 2020


On Thursday, 24 December 2020 at 15:00:16 UTC, jmh530 wrote:
> That Foo-ish reminds me of something in D like
>
>     static if (__traits(compiles, {
>         auto temp = Foo!T.init;
>     }))

Yes, it is similar in spirit. It is pretty much the same as the 
C++17 version, but easier to write, especially when you require 
many operators (e.g. "a+b", "a*b" etc). I am not sure if C++20 
concepts bring anything truly new, but easier on the eyes and 
more likely to be used correctly. Which is important. A new 
feature isn't necessarily about making new things possible, 
encouraging correct code is just as important.



More information about the Digitalmars-d-announce mailing list