如果运算符为C++类重载,我怎么能使用默认运算符呢?

sha*_*oth 5 c++ operator-overloading

_com_ptr_有一个带有副作用的重载运算符&().如果我有一个变量:

_com_ptr_t<Interface> variable;
Run Code Online (Sandbox Code Playgroud)

如何在不调用重载运算符并触发副作用的情况下检索其地址(_com_ptr_t <Interface>*指针)?

MSa*_*ers 7

我已经看到这个案例在ISO会议中弹出,因为它打破了一些offsetof()宏实现(LWG 273).解决方案:&reinterpret_cast<unsigned char&>(variable)