This commit is contained in:
Robin Dietzel 2023-11-01 21:04:12 +01:00
parent e942e95712
commit 11190a0eee
2 changed files with 6 additions and 5 deletions

View File

@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.0)
project(task1) project(task1)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 20)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON) set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOUIC ON)

View File

@ -6,6 +6,7 @@
#include <mutex> #include <mutex>
#include <future> #include <future>
#include <ranges> #include <ranges>
#include <span>
namespace algo { namespace algo {
@ -332,10 +333,10 @@ namespace algo {
std::advance(mid, std::distance(data.begin(), data.end()) / 2); std::advance(mid, std::distance(data.begin(), data.end()) / 2);
std::span<T> left(data.begin(), mid);
std::span<T> right(mid, data.end());
std::vector<T> left(std::make_move_iterator(data.begin()), std::make_move_iterator(mid)); //std::vector<T> left(std::make_move_iterator(data.begin()), std::make_move_iterator(mid));
std::vector<T> right(std::make_move_iterator(mid), std::make_move_iterator(data.end())); //std::vector<T> right(std::make_move_iterator(mid), std::make_move_iterator(data.end()));
if (depth < num_threads) { if (depth < num_threads) {
std::thread left_thread([&]() { split(left, outdata, cmp, depth + 1, num_threads, mut); }); std::thread left_thread([&]() { split(left, outdata, cmp, depth + 1, num_threads, mut); });