mp-units icon indicating copy to clipboard operation
mp-units copied to clipboard

refactor: apply nodiscard to constructors

Open JohelEGP opened this issue 4 years ago • 3 comments

JohelEGP avatar Feb 22 '21 04:02 JohelEGP

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.

mpusz avatar Jun 01 '24 12:06 mpusz

That example seems wrong. The one to construct is the function author, not the caller: https://cpp1.godbolt.org/z/hGThETx8T.

JohelEGP avatar Jun 01 '24 12:06 JohelEGP

You are right!

mpusz avatar Jun 01 '24 14:06 mpusz