13 template <
typename proj_t,
typename angle_desc_t>
15 std::size_t maxCmpsAfterMerge,
const proj_t &
proj,
16 const angle_desc_t &desc) {
19 auto remainingComponents = cmpCache.size();
21 while (remainingComponents > maxCmpsAfterMerge) {
31 proj(cmpCache[minJ]).weight = -1.0;
34 remainingComponents--;
38 std::sort(cmpCache.begin(), cmpCache.end(),
39 [&](
const auto &
a,
const auto &
b) {
43 std::remove_if(cmpCache.begin(), cmpCache.end(),
44 [&](
const auto &
a) {
return proj(
a).weight == -1.0; }),
47 assert(cmpCache.size() == maxCmpsAfterMerge &&
"size mismatch");
53 std::size_t maxCmpsAfterMerge,
55 if (cmpCache.size() <= maxCmpsAfterMerge) {
59 auto proj = [](
auto &
a) -> decltype(
auto) {
return a; };