#define VALIDATECOMPTR | ( | type, | |
smartComPtr | |||
) | IID_##type, reinterpret_cast<P6R::P6VOID**>(static_cast<type**>((smartComPtr).addressofWithRelease())) |
COM interfaces provide many advantages, however, one weakness is the use of void pointers in getters dealing with interface pointers.
To help mitigate the absence of type safety, we have provide this macro to enforce compile time type safety when assigning interface pointers via getters. This macro also helps prevent interface leaks through its use of p6ComPtr's addressOfWithRelease() method when assiging interface pointers. This ensures that any previously assigned interface pointer is released prior to assigning a new pointer. This should be used anywhere that interface pointers are assigned to a p6ComPtr by specifying and interface ID.
Here's and example:
Definition at line 430 of file p6comptr.h.