类型转换时去掉对象 const 属性并修改对象
C++-Undefined-Behavior-36
示例:
const int ci = 0;
const_cast<int&>(ci) = 1; // Undefined behavior
依据
ISO/IEC 14882:2003 5.2.11(7)-undefined
ISO/IEC 14882:2011 5.2.11(7)-undefined
示例:
const int ci = 0;
const_cast<int&>(ci) = 1; // Undefined behavior