diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/2018/day6/aoc.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/2018/day6/aoc.h b/src/2018/day6/aoc.h index f79702c..282f385 100644 --- a/src/2018/day6/aoc.h +++ b/src/2018/day6/aoc.h @@ -35,11 +35,11 @@ struct coordinate { } int distance(coordinate c = coordinate{0, 0}) const noexcept { return std::abs(x - c.x) + std::abs(y - c.y); } - coordinate right(int d) { return {x + d, y}; } - coordinate up(int d) { return {x, y - d}; } - coordinate left(int d) { return {x - d, y}; } - coordinate down(int d) { return {x, y + d}; } - typedef coordinate (coordinate::*move)(int); + coordinate right(int d) const noexcept { return {x + d, y}; } + coordinate up(int d) const noexcept { return {x, y - d}; } + coordinate left(int d) const noexcept { return {x - d, y}; } + coordinate down(int d) const noexcept { return {x, y + d}; } + typedef coordinate (coordinate::*move)(int) const; bool operator<(const coordinate& c) const noexcept { int d1 = distance(); |