1.. _parallel_sort_ranges_extension: 2 3parallel_sort ranges interface extension 4======================================== 5 6.. contents:: 7 :local: 8 :depth: 1 9 10Description 11*********** 12 13|full_name| implementation extends the `oneapi::tbb::parallel_sort specification <https://spec.oneapi.io/versions/latest/elements/oneTBB/source/algorithms/functions/parallel_sort_func.html>`_ 14with overloads that takes the container by forwarding reference. 15 16 17API 18*** 19 20Header 21------ 22 23.. code:: cpp 24 25 #include <oneapi/tbb/parallel_sort.h> 26 27Syntax 28------ 29 30.. code:: cpp 31 32 namespace oneapi { 33 namespace tbb { 34 35 template <typename Container> 36 void parallel_sort( Container&& c ); 37 template <typename Container, typename Compare> 38 void parallel_sort( Container&& c, const Compare& comp ); 39 40 } // namespace tbb 41 } // namespace oneapi 42 43Functions 44--------- 45 46.. cpp:function:: template <typename Container> void parallel_sort( Container&& c ); 47 48 Equivalent to ``parallel_sort( std::begin(c), std::end(c), comp )``, where `comp` uses `operator<` to determine relative orderings. 49 50.. cpp:function:: template <typename Container, typename Compare> void parallel_sort( Container&& c, const Compare& comp ); 51 52 Equivalent to ``parallel_sort( std::begin(c), std::end(c), comp )``. 53 54Example 55------- 56 57This interface may be used for sorting rvalue or constant views: 58 59.. code:: cpp 60 61 #include <array> 62 #include <span> // requires C++20 63 #include <oneapi/tbb/parallel_sort.h> 64 65 std::span<int> get_span() { 66 static std::array<int, 3> arr = {3, 2, 1}; 67 return std::span<int>(arr); 68 } 69 70 int main() { 71 tbb::parallel_sort(get_span()); 72 } 73