llvm::ComputeEditDistance

Determine the edit distance between two sequences.

Synopsis

Declared in <llvm/ADT/edit_distance.h>

template<typename T>
unsigned int
ComputeEditDistance(
    ArrayRef<T> FromArray,
    ArrayRef<T> ToArray,
    bool AllowReplacements = true,
    unsigned int MaxEditDistance = 0);

Description

This is a convenience wrapper around ComputeMappedEditDistance that compares elements directly without applying a mapping functor.

Return Value

The minimum number of element insertions, removals, or (if AllowReplacements is true) replacements needed to transform one of the given sequences into the other. If zero, the sequences are identical.

Parameters

NameDescription
FromArrayThe first sequence to compare.
ToArrayThe second sequence to compare.
AllowReplacementsWhether to allow element replacements (change one element into another) as a single operation, rather than as two operations (an insertion and a removal).
MaxEditDistanceIf non-zero, the maximum edit distance that this routine is allowed to compute. If the edit distance will exceed that maximum, returns MaxEditDistance+1.