On 10/13/17 3:24 PM, Steven Schveighoffer wrote:
On 10/13/17 3:11 PM, jmh530 wrote:
On Friday, 13 October 2017 at 18:36:58 UTC, Luís Marques wrote:
[snip]

What if it were package instead of private?

This wouldn't help, sum is in phobos, Duration in druntime.

The answer is that sum shouldn't be too clever. IMO, initializing to 0 should be only done if the type's .init value doesn't match 0. Since only floating points and char/wchar/dchar do this, just do the Seed(0) for those, else use Seed.init.

I take the last part back a bit. Some custom types may default to NaN-like values, so Seed(0) is necessary.

What should happen is that sum should test if Seed(0) is viable, and if not, use Seed.init.

-Steve

Reply via email to