Hi,
I can't seem to find any documentation as to how
STL indicates method failure, whether by return
code or exception.
If you pass in the wrong parameters, you generally get undefined
behaviour, not any exception. Few STL methods can actually fail of
their own accord for any reason other than memory exhaustion.
e.g how would I test for out of memory case
when inserting into a vector
All expected exceptions are generally documented with the functions
that throw them (e.g. vector::at). However, many functions can fail if
memory is exhausted. The out of memory case depends on the allocator
argument of the container. With std::allocator, you'll get
std::bad_alloc on failure. Mostly exceptions will come from your own
classes that the STL is using as template parameters - e.g. if your
copy constructor can throw, that will be propogated by the STL
functions.
You'll probably want to read the appendix on library exception safety
in recent editions of Stroustrup's book:
http://www.research.att.com/~bs/3rd_safe0.html
He's kindly posted the PDF online.
Tom