From 1d0fae267b73f774c075c9604c8535224c19453b Mon Sep 17 00:00:00 2001 From: Bert Peters Date: Sun, 15 Dec 2019 18:25:28 +0100 Subject: [PATCH] Prevent unnecessary copy --- 2019/src/day15.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2019/src/day15.cpp b/2019/src/day15.cpp index bdf37cd..8c0d90b 100644 --- a/2019/src/day15.cpp +++ b/2019/src/day15.cpp @@ -145,7 +145,7 @@ void aoc2019::day15_part1(std::istream &input, std::ostream &output) { void aoc2019::day15_part2(std::istream &input, std::ostream &output) { const auto map = read_map(input); - auto starting_point = std::find_if(map.begin(), map.end(), [](auto x) { return x.second == Tile::Oxygen; })->first; + auto starting_point = std::find_if(map.begin(), map.end(), [](auto &x) { return x.second == Tile::Oxygen; })->first; auto dist = bfs(map, starting_point, [](Tile x) { return false; });