Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Qt 有一个等价于std::runtime_error(likeQString等价于std::string)的类吗?
std::runtime_error
QString
std::string
具体来说,std::runtime_error保存一个描述错误的字符串,所以你可以这样做:
throw std::runtime_error("my error description");
不,Qt 不使用异常(除了 QtConcurrent::Exception 用于跨线程抛出和捕获异常)。只需使用标准 C++ 异常类。