3 ms·
> People will often make mistakes when a function has 3 or more ... of anything. This is why non-compatible numeric subtypes are so valuable. Code like "quanti
by Psychlist 5y ago
> People will often make mistakes when a function has 3 or more ...
of anything. This is why non-compatible numeric subtypes are so valuable. Code like "quantity_sold = price" should not compile. You can do the same thing for other types using the same template but IME that's somewhat less common (but does happen: user_name = address!!).
It would be nice to get a variation on std::pair that works in a similar way to Rust's std::result<value, error>, because std::optional is just a dressed up boolean. I did just swipe the std::pair declaration and do that, but having it official would be nice. Especially for the non-throwing version of the standard libraries.