algo/search: return the score and the object in minimises
This commit is contained in:
parent
0138b00f87
commit
e26165cea9
@ -61,6 +61,6 @@ namespace cruft::search {
|
||||
}
|
||||
}
|
||||
|
||||
return best_item;
|
||||
return std::pair (std::move (best_score), std::move (best_item));
|
||||
}
|
||||
}
|
@ -30,14 +30,14 @@ main (void)
|
||||
};
|
||||
|
||||
|
||||
auto best = cruft::search::minimises (
|
||||
auto const [best_score, best_iterator] = cruft::search::minimises (
|
||||
std::begin (src),
|
||||
std::end (src),
|
||||
[] (auto const a, auto const b) { return cruft::distance2 (a, b); },
|
||||
dst
|
||||
);
|
||||
|
||||
tap.expect_eq (best, src + 2, "minimises point3 using distance2");
|
||||
tap.expect_eq (best_iterator, src + 2, "minimises point3 using distance2");
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user