C++ Standard Library Exception List? -


What is a reference about the C ++ standard library exception? I just want to know which works can throw exceptions or not.

In fact, most standard library functions do not throw exceptions themselves. They simply pass on the exceptions threw by the user code applied by them. For example, if you can remove push_back () from an element of a vector, it can throw (due to memory allocation errors) and if the copy produces the creator throws

A few notable exceptions (no intention) where library throws functions:

  • Throw out some methods out_of_range if the provided index is invalid:
    • std :: vector & lt; & Gt; :: at ()
    • std :: basic_string & lt; & Gt; :: at ()
    • std :: bitset & lt; & Gt; :: Set () , reset () and flip () .
    • Some methods will throw std :: overflow_error over the integer overflow:
      • std :: bitset < & Gt; ; :: to_ulong () and (C + 0x) to_ullong () .
    • std :: allocator & lt; T & gt; std :: bad_alloc will be thrown by new which invites it
    • You can set up the stream so that a state bit set std :: ios_base :: failure is thrown on
    • large array allocation std :: bad_array_new_length
    • if any Dynamic_cast on reference std :: bad_cast (technically not part of standard library)
    • With an exception specification, throwing an invalid exception from a function std :: bad_exception
    • Std :: function :: operator (...) if it does not have any value then Std :: bad_function_call .
    • TypeInfo can throw std :: bad_typeid of a zero pointer.
    • After the release of Pointei by reaching weak_ptr Std :: bad_weak_ptr .
    • std :: future_error could throw away from the wrong use of std :: promise / std :: future .
    • (c + + 11) string conversion function std :: stoi , std :: stol , Std :: stoll , std :: stoul , std :: stoull , std :: stof , std: : Stod , and std :: stold both std :: invalid_argument and std :: out_of_range .
    • (c ++11) In the Regedx family, the constructor and assignment methods can remove std :: regex_error .

    (I am making it a CW answer, so if someone can think of such a thing, please do not hesitate to attach them here.)

    In addition, for the 3rd edition C ++ programming language , downloadable in Burgeley Strawstrop, which can be relevant


Comments