TBoundPointerProperty.operator==(_InterfacePtr) (Compact 7)
3/12/2014
The == overloaded operator determines whether a pointer that is contained in a TBoundPointerProperty<PropertyType> object and another pointer both point to an object located at the same address in memory.
Syntax
template<typename _InterfacePtr>
bool operator==(
_InterfacePtr p)
Parameters
- p
[in] Pointer to compare with the pointer that is contained in the TBoundPointerProperty<PropertyType> object.
Return Value
Returns true if the two pointers point to an object at the same address in memory; otherwise, returns false.
Remarks
The _InterfacePtr type must inherit from IUnknown. To compare two pointers of the same type, the type of the pointer in the p parameter must be the type that you specified in the PropertyType template parameter of TBoundPointerProperty<PropertyType>.
If both pointers are Null pointers, the equality operator returns true.
When you use the == overloaded operator for a TBoundPointerProperty<PropertyType>, use the operator as a function and use the p parameter as the function’s argument instead of using it as an operand in a C++ expression. Otherwise, the Visual Studio compiler returns error code C2678 when you build your application.
Example
The following example code demonstrates one way to use the == overloaded operator.
Important
For readability, the following code example does not contain security checking or error handling. Do not use the following code in a production environment.
#include "XamlRuntime.h"
#include "XRPropertyBag.h"
#define CHK_BOOL(x) { \
if (!(x)) { \
ASSERT(!"Assertion failed"); \
return E_FAIL; \
}}
TBoundPointerProperty<IXREnumerable>* pValue1;
IXREnumerablePtr pValue2;
CHK_BOOL(pValue1->operator ==(pValue2));
Requirements
Header |
XRPropertyBag.h |
See Also
Reference
TBoundPointerProperty<PropertyType>
TBoundPointerProperty.operator!=(_InterfacePtr)