mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-26 13:20:32 +01:00
Reduce allocations.
This commit is contained in:
@@ -38,9 +38,11 @@ namespace {
|
|||||||
std::pair<std::size_t, std::size_t> part1(const std::vector<point_t> &points) {
|
std::pair<std::size_t, std::size_t> part1(const std::vector<point_t> &points) {
|
||||||
std::size_t best = 0;
|
std::size_t best = 0;
|
||||||
std::size_t best_index = 0;
|
std::size_t best_index = 0;
|
||||||
|
std::unordered_set<point_t> visible;
|
||||||
|
|
||||||
for (std::size_t i = 0; i < points.size(); ++i) {
|
for (std::size_t i = 0; i < points.size(); ++i) {
|
||||||
std::unordered_set<point_t> visible;
|
visible.clear();
|
||||||
|
|
||||||
const auto point = points[i];
|
const auto point = points[i];
|
||||||
|
|
||||||
for (auto asteroid : points) {
|
for (auto asteroid : points) {
|
||||||
|
|||||||
Reference in New Issue
Block a user