PickPivotAndPartition()

System::MemoryExtensions::Details::PickPivotAndPartition(Span<TKey>&, Span<TValue>&, std::function<int32_t(const TKey&, const TKey&)>) function

Selects pivot and partitions key-value pairs for quicksort.

template<typename TKey,typename TValue> int32_t System::MemoryExtensions::Details::PickPivotAndPartition(Span<TKey> &keys, Span<TValue> &values, std::function<int32_t(const TKey &, const TKey &)> comparer)

Template parameters

ParameterDescription
TKeyThe type of keys
TValueThe type of values

Arguments

ParameterTypeDescription
keysSpan<TKey>&The span of keys to partition
valuesSpan<TValue>&The span of values to partition
comparerstd::function<int32_t(const TKey&, const TKey&)>Comparison function for keys

Return Value

The pivot index after partitioning

See Also