Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2022-03-22 03:13:28 +0300
committerBrecht Van Lommel <brecht@blender.org>2022-03-22 03:30:19 +0300
commitfab14f78542ca040cc1606dbd33a4db6aea5976a (patch)
tree080478f6ef6b80c43d8529049b19ea75d3f47733 /source/blender/blenlib/BLI_sort.hh
parent976c91cd770f4323d4a5007e5bf444b8c701278b (diff)
Fix build when using WITH_TBB=OFF after recent changes
And wrap tbb::parallel_sort in blender namespace similar to other TBB functionality.
Diffstat (limited to 'source/blender/blenlib/BLI_sort.hh')
-rw-r--r--source/blender/blenlib/BLI_sort.hh32
1 files changed, 32 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_sort.hh b/source/blender/blenlib/BLI_sort.hh
new file mode 100644
index 00000000000..411e6a0c4df
--- /dev/null
+++ b/source/blender/blenlib/BLI_sort.hh
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#pragma once
+
+/** \file
+ * \ingroup bli
+ */
+
+#ifdef WITH_TBB
+# include <tbb/parallel_sort.h>
+#else
+# include <algorithm>
+#endif
+
+namespace blender {
+
+#ifdef WITH_TBB
+using tbb::parallel_sort;
+#else
+template<typename RandomAccessIterator>
+void parallel_sort(RandomAccessIterator begin, RandomAccessIterator end)
+{
+ std::sort<RandomAccessIterator>(begin, end);
+}
+template<typename RandomAccessIterator, typename Compare>
+void parallel_sort(RandomAccessIterator begin, RandomAccessIterator end, const Compare &comp)
+{
+ std::sort<RandomAccessIterator, Compare>(begin, end, comp);
+}
+#endif
+
+} // namespace blender