首页 > 解决方案 > 在 c++ 20 中删除了 throw 函数。你现在如何抛出异常?

问题描述

更新代码时,我找不到任何关于throw用 c++ 替换 a 的内容。throw在下一个版本c++20中将删除seeing 。

它也被弃用了,我找不到关于接受的替代品是什么的信息。例子:

const Vec2 &    normalize ();           // modifies *this
const Vec2 &    normalizeExc () throw (IEX_NAMESPACE::MathExc);
const Vec2 &    normalizeNonNull ();

Vec2<T>     normalized () const;    // does not modify *this
Vec2<T>     normalizedExc () const throw (IEX_NAMESPACE::MathExc);
Vec2<T>     normalizedNonNull () const;

标签: c++exceptionthrow

解决方案


推荐阅读