2 ms·
In 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.
by planede 4y ago
In 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.