Compartilhar via


TBoundProperty<BSTR>.operator<(TBoundProperty&) (Compact 2013)

3/28/2014

The < overloaded operator determines whether a string in a TBoundProperty<BSTR> object is less than a string in another TBoundProperty<BSTR> object in a C++ expression.

Syntax

bool operator<(
TBoundProperty & value)

Parameters

  • value
    [in] Pointer to a TBoundProperty<BSTR> object that is the operand on the right in a C++ expression.

Return Value

Returns true if the operand on the left is lexicographically less than the operand on the right. Otherwise, returns false.

Remarks

In a lexicographic comparison, if a string has fewer characters than another string, the shorter string is considered to be less than the longer string.

The following example code uses the < operator to determine whether a string in a TBoundProperty<BSTR> object is lexicographically less than another string.

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 "XRPropertyBag.h"
#include "oleauto.h"

#define CHK_BOOL(x) { \
    if (!(x)) { \
        ASSERT(!"Assertion failed"); \
        return E_FAIL; \
    }}

// Initialize and allocate binary strings.
BSTR propString1;
BSTR propString2;

propString1 = SysAllocString(L"Nov");
propString2 = SysAllocString(L"November");

// Create TBoundProperty<BSTR> objects to represent properties.
TBoundProperty<BSTR> propObj1;
TBoundProperty<BSTR> propObj2;

// Set the property values to the binary strings.
propObj1.Set(propString1);
propObj2.Set(propString2);

// Use the < overloaded operator.
CHK_BOOL(propObj1 < propObj2);

Requirements

Header

oleauto.h,
XRPropertyBag.h

Library

oleaut32.lib

See Also

Reference

C++ Overloaded Operators for TBoundProperty<BSTR>
TBoundProperty<BSTR>.operator<=(TBoundProperty&)
TBoundProperty<BSTR>