Why can't i
if (IUnknownPtr p = anotherComPtr) {} //error C2275: 'IUnknownPtr' : illegal use of this type as an expression
while i can
if (int* a = anotherPointer) {}
IUnknownPtr
is defined throught _COM_SMARTPTR_TYPEDEF(IUnknown, __uuidof(IUnknown))
(like any others smart pointers i use)
How can i create a com smartptr within if
statement and verify is it valid or not? Thank you.
I use VS 2008
p.s. This is not about is it good way of coding or not, it's about error C2275
.
No comments:
Post a Comment