1.4 version 4:匹配于c++标准运行库
我们所有的standard_exception继承类都提供公有的成员
virtual char const *what() const;
来识别异常的动态类型。我不是随便选取的函数名:所有的c++标准运行库中的std::exception继承类为同样的目的提供了同样的公有成员。并且,what()是每个继承类的唯一的多态函数。
你可能已经注意到:
#include <exception>
class structured_exception : public std::exception
{
public:
structured_exception(exception_pointers const &info) throw();
static void install() throw();
virtual char const *what() const throw();
void const *where() const throw();
private:
void const *address_;
};
因为structured_exception现在也是一个std:exception,我们可以用一个异常处理函数来同时捕获这个异常族:
catch (std::exception const &exception)