This adds [[nodiscard]] throughout , as proposed by P2377R0 (with some minor corrections). The attribute is added for all modes from C++11 up, using [[__nodiscard__]] or _GLIBCXX_NODISCARD where C++17 [[nodiscard]] can't be used directly.