Hacker News new | ask | show | jobs
by KaeseEs 5009 days ago
It is flatly untrue that you cannot use the C++ STL if you don't use exceptions. std::nothrow exists for exactly that reason.
1 comments

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.

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.