SVector.H:
void pop_back() throw (underflow_error);
在我的 SVector.cpp 文件中,我是否也应该包含 throw (underflow_error) 部分?
void pop_back() throw (underflow_error)
{
// implementation
}
或
void pop_back()
{
// implementation
}
谢谢。
最佳答案
15.4/2
:
If any declaration of a function has an exception-specification, all declarations, including the definition and an explicit specialization, of that function shall have an exception-specification with the same set of type-ids.
关于c++ - 我是否也仅在函数头或声明中指定异常类型? (C++),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2436908/