From ef9f0792699b13d5994cd1403436e2ae875aec7b Mon Sep 17 00:00:00 2001 From: Dmitriy Sobolev Date: Mon, 2 Sep 2024 14:38:39 +0100 Subject: [PATCH] Clarify the assosition between keys and values Signed-off-by: Dmitriy Sobolev --- source/elements/oneDPL/source/parallel_api.rst | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/source/elements/oneDPL/source/parallel_api.rst b/source/elements/oneDPL/source/parallel_api.rst index 4d42fba95..5c20bb88d 100644 --- a/source/elements/oneDPL/source/parallel_api.rst +++ b/source/elements/oneDPL/source/parallel_api.rst @@ -698,9 +698,12 @@ The elements e of [start, end) must be partitioned with respect to the comparato InputValueIt values_first, Comparator comp = std::less::value_type>()); -``oneapi::dpl::sort_by_key`` sorts a sequence of keys in the range ``[keys_first, keys_last)``, -and permutes a sequence of values in the range -``[values_first, values_first + distance(keys_first, keys_last))`` to match the order of the sorted keys. +``oneapi::dpl::sort_by_key`` sorts a sequence of keys within the range ``[keys_first, keys_last)``. +It also permutes the corresponding sequence of values within the range +``[values_first, values_first + distance(keys_first, keys_last))``. +Each key is associated with a corresponding value, +and this association is maintained throughout the sorting process. + The order of equal keys is not guaranteed to be preserved. If no comparator is provided, the keys are sorted with respect to ``std::less{}``. @@ -715,9 +718,12 @@ If no comparator is provided, the keys are sorted with respect to ``std::less{}` InputValueIt values_first, Comparator comp = std::less::value_type>()); -``oneapi::dpl::stable_sort_by_key`` sorts a sequence of keys in the range ``[keys_first, keys_last)``, -and permutes a sequence of values in the range -``[values_first, values_first + distance(keys_first, keys_last))`` to match the order of the sorted keys. +``oneapi::dpl::stable_sort_by_key`` sorts a sequence of keys within the range ``[keys_first, keys_last)``. +It also permutes the corresponding sequence of values within the range +``[values_first, values_first + distance(keys_first, keys_last))``. +Each key is associated with a corresponding value, +and this association is maintained throughout the sorting process. + The order of equal keys is preserved. If no comparator is provided, the keys are sorted with respect to ``std::less{}``.