Get the address of an object that has overloaded operator&
问题 operator& for CComPtr is overloaded, which makes my generically written code crash. I am wondering if there is any way to force a variable into returning the address of it's object? 回答1: The solution is hideous: reinterpret_cast<CComPtr*>(&reinterpret_cast<char&>(ptr)) 回答2: If you can use boost, consider using: addressof, if you cannot, take a look at the implementation. 回答3: You could cast the CComPtr to a CComPtrBase , which, from what I can gather from the MSDN page, has no overloaded