[libcxx-commits] [libcxx] [libc++] Remove [[nodiscard]] from map etc. operator[] (PR #172444)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Dec 16 02:07:33 PST 2025
================
@@ -465,13 +465,13 @@ class flat_map {
}
// [flat.map.access], element access
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 mapped_type& operator[](const key_type& __x)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 mapped_type& operator[](const key_type& __x)
----------------
philnik777 wrote:
I think you could interpret `where discarding the value is most likely a misuse of the function` to apply here, but that's not exactly the spirit. I do think that there is value in pointing people to APIs which better suit their use-case, but I don't think that's currently captured in the guidelines.
https://github.com/llvm/llvm-project/pull/172444
More information about the libcxx-commits
mailing list