System.Variants.TCustomVariantType.Compare

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

procedure Compare(const Left, Right: TVarData;
var Relationship: TVarCompareResult); virtual;

C++

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

Properties

Type Visibility Source Unit Parent
procedure
function
public
System.Variants.pas
System.Variants.hpp
System.Variants 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