mp-units
mp-units copied to clipboard
refactor: apply nodiscard to constructors
I do not think it is a good idea. If some function does its primary functionality and returns a quantity just as additional (e.g., debug) information, then the user should not be forced to store such a quantity.
That example seems wrong. The one to construct is the function author, not the caller: https://cpp1.godbolt.org/z/hGThETx8T.
You are right!