You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Technically, NonZero* types are not meant to be used for optimizing arithmetic, but people (like myself) may or may not know that or may assume otherwise.
It is possible to create a NonZero* object with 0 inner value, but since that is a misuse of the type and deliberate violation of the safety guarantees, I think it would make sense to teach the compiler that get() can't return 0.
Edit: unfortunately, since NonZero* methods are const, it's not as simple as adding an assume.