[libcxx-commits] [PATCH] D108384: [libc++][NFCI] Remove unnecessary exception-throwing base classes
Arthur O'Dwyer via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Aug 19 10:00:32 PDT 2021
Quuxplusone added inline comments.
================
Comment at: libcxx/include/deque:1853
if (__i >= __base::size())
- __base::__throw_out_of_range();
+ _VSTD::__throw_out_of_range("deque::at: index out of bounds");
size_type __p = __base::__start_ + __i;
----------------
I spoke slightly too soon. You //are// gratuitously changing the what-message here, right? That's definitely not "NFCI", and I'm ambivalent as to whether it's a good idea. The old message is just the word `"deque"`, which is not great, but it at least has the virtue of taking up not-too-many bytes of storage. Whereas adding "...index out of bounds" to an exception of type `std::out_of_range` really isn't adding anything useful, is it? The user should already know what "out of range" means.
I suggest doing the NFC part alone, and then following up with a non-NFC change from `"deque"` to `"deque::at"` — spending 4 bytes to get a bit more useful info, but not going further than that.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D108384/new/
https://reviews.llvm.org/D108384
More information about the libcxx-commits
mailing list