【发布时间】:2014-03-28 16:06:54
【问题描述】:
boost::math::quaternion 的实现(您可以浏览它here)广泛使用注释为// exception guard 的成语。例如:
template<typename X>
quaternion<T> & operator += (quaternion<X> const & rhs)
{
T at = a + static_cast<T>(rhs.R_component_1()); // exception guard
T bt = b + static_cast<T>(rhs.R_component_2()); // exception guard
T ct = c + static_cast<T>(rhs.R_component_3()); // exception guard
T dt = d + static_cast<T>(rhs.R_component_4()); // exception guard
a = at;
b = bt;
c = ct;
d = dt;
return(*this);
}
// exception guard 在这种情况下是什么意思?
【问题讨论】: