sha*_*oth 5 c++ operator-overloading
_com_ptr_有一个带有副作用的重载运算符&().如果我有一个变量:
_com_ptr_t<Interface> variable;
Run Code Online (Sandbox Code Playgroud)
如何在不调用重载运算符并触发副作用的情况下检索其地址(_com_ptr_t <Interface>*指针)?
我已经看到这个案例在ISO会议中弹出,因为它打破了一些offsetof()宏实现(LWG 273).解决方案:&reinterpret_cast<unsigned char&>(variable)
| 归档时间: |
|
| 查看次数: |
549 次 |
| 最近记录: |