CommonPrefixLength()

System::MemoryExtensions::CommonPrefixLength(const ReadOnlySpan<T>&, const ReadOnlySpan<T>&) function

Finds the length of the common prefix between two spans.

template<typename T> int32_t System::MemoryExtensions::CommonPrefixLength(const ReadOnlySpan<T> &span, const ReadOnlySpan<T> &other)

Template parameters

ParameterDescription
TThe type of elements in the spans

Arguments

ParameterTypeDescription
spanconst ReadOnlySpan<T>&The first span
otherconst ReadOnlySpan<T>&The second span

Return Value

The number of matching elements at the beginning of both spans

System::MemoryExtensions::CommonPrefixLength(const Span<T>&, const ReadOnlySpan<T>&) function

Finds the length of the common prefix between a mutable span and a read-only span.

template<typename T> int32_t System::MemoryExtensions::CommonPrefixLength(const Span<T> &span, const ReadOnlySpan<T> &other)

Template parameters

ParameterDescription
TThe type of elements in the spans

Arguments

ParameterTypeDescription
spanconst Span<T>&The mutable span
otherconst ReadOnlySpan<T>&The read-only span

Return Value

The number of matching elements at the beginning of both spans

System::MemoryExtensions::CommonPrefixLength(const Span<T>&, const Span<T>&) function

Finds the length of the common prefix between two mutable spans.

template<typename T> int32_t System::MemoryExtensions::CommonPrefixLength(const Span<T> &span, const Span<T> &other)

Template parameters

ParameterDescription
TThe type of elements in the spans

Arguments

ParameterTypeDescription
spanconst Span<T>&The first mutable span
otherconst Span<T>&The second mutable span

Return Value

The number of matching elements at the beginning of both spans

System::MemoryExtensions::CommonPrefixLength(const ReadOnlySpan<T>&, const ReadOnlySpan<T>&, const SharedPtr<TEqualityComparer>&) function

Finds the length of the common prefix between two spans using a custom equality comparer.

template<typename T,typename TEqualityComparer> int32_t System::MemoryExtensions::CommonPrefixLength(const ReadOnlySpan<T> &span, const ReadOnlySpan<T> &other, const SharedPtr<TEqualityComparer> &comparer)

Template parameters

ParameterDescription
TThe type of elements in the spans
TEqualityComparerThe type of the equality comparer

Arguments

ParameterTypeDescription
spanconst ReadOnlySpan<T>&The first span
otherconst ReadOnlySpan<T>&The second span
comparerconst SharedPtr<TEqualityComparer>&The equality comparer to use for element comparison

Return Value

The number of matching elements at the beginning of both spans

System::MemoryExtensions::CommonPrefixLength(const Span<T>&, const ReadOnlySpan<T>&, const SharedPtr<TEqualityComparer>&) function

Finds the length of the common prefix between a mutable span and a read-only span using a custom equality comparer.

template<typename T,typename TEqualityComparer> int32_t System::MemoryExtensions::CommonPrefixLength(const Span<T> &span, const ReadOnlySpan<T> &other, const SharedPtr<TEqualityComparer> &comparer)

Template parameters

ParameterDescription
TThe type of elements in the spans
TEqualityComparerThe type of the equality comparer

Arguments

ParameterTypeDescription
spanconst Span<T>&The mutable span
otherconst ReadOnlySpan<T>&The read-only span
comparerconst SharedPtr<TEqualityComparer>&The equality comparer to use for element comparison

Return Value

The number of matching elements at the beginning of both spans

System::MemoryExtensions::CommonPrefixLength(const Span<T>&, const Span<T>&, const SharedPtr<TEqualityComparer>&) function

Finds the length of the common prefix between two mutable spans using a custom equality comparer.

template<typename T,typename TEqualityComparer> int32_t System::MemoryExtensions::CommonPrefixLength(const Span<T> &span, const Span<T> &other, const SharedPtr<TEqualityComparer> &comparer)

Template parameters

ParameterDescription
TThe type of elements in the spans
TEqualityComparerThe type of the equality comparer

Arguments

ParameterTypeDescription
spanconst Span<T>&The first mutable span
otherconst Span<T>&The second mutable span
comparerconst SharedPtr<TEqualityComparer>&The equality comparer to use for element comparison

Return Value

The number of matching elements at the beginning of both spans

See Also