One could at the very least perform these using std::async:
auto make_order = [&f, &orders_ref](auto& predicate) {
std::sort(orders_ref[f].begin(), orders_ref[f].end(), predicate);
++f;
};
make_order(comparator);
(make_order(comparators), ...);
But they could be combined with a direct call to best_packing_for_ordering instead of calling find_best_packing_impl. The workers would of course need to declare their own:
empty_spaces_type root = rect_wh();
root.flipping_mode = input.flipping_mode;
And then after all workers complete, re-insert the best order and handle successful/unsuccessful insertions.
However, it would be good to only do this under #ifndef RECTPACK2D_SINGLETHREADED just in case.
One could at the very least perform these using
std::async:But they could be combined with a direct call to
best_packing_for_orderinginstead of callingfind_best_packing_impl. The workers would of course need to declare their own:And then after all workers complete, re-insert the best order and handle successful/unsuccessful insertions.
However, it would be good to only do this under
#ifndef RECTPACK2D_SINGLETHREADEDjust in case.