SwapIfGreaterWithValues()

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

Swaps key-value pairs if comparison condition is met.

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

Template parameters

ParameterDescription
TKeyThe type of keys
TValueThe type of values

Arguments

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

See Also