P
Pete Becker
Stuart said:Thinking about it, though, presumably if there are two or more
such situations, you'd need to keep changing the unexpected handler?
The usual idiom (if there is one) is to use a class whose constructor
installs the handler you want and whose destructor restores the previous
handler.
You can also do it with one handler, but it's more complicated. You have
to detect the type that was thrown (by rethrowing the original exception
and catching it by type), then throw the appropriate replacement.
--
-- Pete
Author of "The Standard C++ Library Extensions: a Tutorial and
Reference." For more information about this book, see
www.petebecker.com/tr1book.