Variants.TCustomVariantType.Compare

From RAD Studio VCL Reference
Jump to: navigation, search

C++ Information

From Variants.hpp

	virtual void __fastcall Compare(const TVarData & Left, const TVarData & Right, Variants::TVarCompareResult & Relationship);


Unit: Variants

Type: method

Visibility: public

Member Of: TCustomVariantType

Description

Implements comparisons that involve the custom Variant type.


Override Compare to implement any comparison operators the custom Variant type supports. Descendants can implement comparison operators by overriding either the Compare or the CompareOp method.

Left is the value that appears to the left of the operator.

Right is the value that appears to the right of the operator.

Relationship returns a value indicating the relationship between Left and Right, as indicated in the following table:



Value Operation

crLessThan

Left is less than Right.

crEqual

Left is equal to Right.

crGreaterThan

Left is greater than Right.



As implemented in TCustomVariantType, CompareOp raises a system error indicating an invalid operation.

Tip:  For custom Variants that support a test of inequality, but not ordering, it makes more sense to override the CompareOp method instead.

See Also

Personal tools
Translations
Newest Version