Share via


警告 C26465

请勿使用 const_cast 强制转换掉 constconst_cast 不是必需的;此转换不会消除 constness 或 volatility。

另请参阅

C++ Core Guidelines Type.3

示例

void function(int* const constPtrToInt)
{
  auto p = const_cast<int*>(constPtrToInt); // C26465, const is not being removed
}