3 ms·
No implementation that I know of throws an exception here.
by planede 4y ago
No implementation that I know of throws an exception here.
- mattgreenrocks 4y agoI stand corrected. It sounded like something that would be done in debug mode by some STL implementations.
- planede 4y agoIn debug mode libstdc++ and libc++ aborts the program with a diagnostic message. This should not be an exception that can be caught, and it rightfully isn't.
- pjmlp 4y agoThey aren't the only implementations around.
- planede 4y agoOK, here is MS STL: https://github.com/microsoft/STL/blob/main/stl/inc/vector#L1700 https://github.com/microsoft/STL/blob/main/stl/inc/vector#L1... Whatever _STL_VERIFY does, pop_back can't throw, as it's marked noexcept. EA STL: https://github.com/electronicarts/EASTL/blob/master/include/EASTL/vector.h#L1075 https://github.com/electronicarts/EASTL/blob/master/include/... Default assertion handler seems to set up a debug break point: https://github.com/electronicarts/EASTL/blob/29a805e4d83d7dd1d8fb03f303b132cc8c0a51c9/source/assert.cpp#L84 https://github.com/electronicarts/EASTL/blob/29a805e4d83d7dd... Macro defined somewhere here: https://github.com/electronicarts/EASTL/blob/76d6842d5d833c032a9ac39df5499190b6bec7b3/include/EASTL/internal/config.h#L612 https://github.com/electronicarts/EASTL/blob/76d6842d5d833c0... Does not seem to throw, but a lot of this is user-configurable. I'm sure I still didn't cover all implementations. You are free to point out a single one that throws on pop_back. Or just ask ChatGPT which implementation throws.
- AnimalMuppet 4y agoSo it's ChatGPT confidently making stuff up. Lovely.