| 41 | |
| 42 | template <typename Iter, typename Comp> |
| 43 | void StableSort(Context const *ctx, Iter begin, Iter end, Comp &&comp) { |
| 44 | if (ctx->Threads() > 1) { |
| 45 | #if defined(GCC_HAS_PARALLEL) |
| 46 | __gnu_parallel::stable_sort(begin, end, comp, |
| 47 | __gnu_parallel::default_parallel_tag(ctx->Threads())); |
| 48 | #else |
| 49 | // the only stable sort is radix sort for msvc ppl. |
| 50 | std::stable_sort(begin, end, comp); |
| 51 | #endif // GLIBC VERSION |
| 52 | } else { |
| 53 | std::stable_sort(begin, end, comp); |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | template <typename Iter, typename Comp> |
| 58 | void Sort(Context const *ctx, Iter begin, Iter end, Comp comp) { |