Debian Codegraph @

packages/seacas/libraries/ioss/src/Ioss_Sort.h

raw
1 // Copyright(C) 1999-2023 National Technology & Engineering Solutions
2 // of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
3 // NTESS, the U.S. Government retains certain rights in this software.
4 //
5 // See packages/seacas/LICENSE for details
6
7 #pragma once
8
9 #if !defined(IOSS_USE_STD_SORT)
10 #include <pdqsort.h>
11 #endif
12
13 #include <cstddef>
14 #include <vector>
15
16 namespace Ioss {
17 template <class Iter, class Comp> inline void sort(Iter begin, Iter end, Comp compare)
18 {
19 #if defined(IOSS_USE_STD_SORT)
20 std::sort(begin, end, compare);
21 #else
22 pdqsort(begin, end, compare);
23 #endif
24 }
25
26 template <class Iter> inline void sort(Iter begin, Iter end)
27 {
28 #if defined(IOSS_USE_STD_SORT)
29 std::sort(begin, end);
30 #else
31 pdqsort(begin, end);
32 #endif
33 }
34
35 template <typename INT> void sort(std::vector<INT> &v)
36 {
37 if (v.size() <= 1) {
38 return;
39 }
40 Ioss::sort(v.begin(), v.end());
41 }
42
43 } // namespace Ioss