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?
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?
If you can use boost, consider using: addressof, if you cannot, take a look at the implementation.
The solution is hideous:
You could cast the
CComPtr
to aCComPtrBase
, which, from what I can gather from the MSDN page, has no overloaded operator. It might look like this:I don't know if this works (I can't try it), but it seems like it might, and if it does, it's a little bit better then the
reinterpret_cast
solution.