The [[nodiscard("reason")]] Attribute

Understand the use of the '[[nodiscard("reason")]]' attribute in C++20.

C++17 introduced the new attribute [[nodiscard]] without a reason. C++20 added the possibility to add a message to the attribute.

Get hands-on with 1400+ tech skills courses.