Hacker News new | ask | show | jobs
by shin_lao 5009 days ago
I'm afraid you might be confusing a parameter supplied to the memory allocator (e.g. nothrow) and the throwing specifications of the STL.

Example: some containers throw std::out_of_range if you access a non-existing element and this has nothing to do with std::nothrow.

1 comments

The only core thing I can think of is “std::bad_cast” with “dynamic_cast”, but I’ve never run into that in practice. “std::out_of_range” only happens when you’re using checked member functions that take indices—which I never do, preferring iterators. However, “std::length_error” can theoretically happen, and nobody checks for it, so there is at least one point of failure.