From 02a57907ec790962731de739a60beac92a170621 Mon Sep 17 00:00:00 2001 From: Matthew Gretton-Dann Date: Thu, 9 Dec 2021 13:55:29 +0000 Subject: [PATCH] Add constexpr to some functions. Fixes Linux build failures. --- 2016/puzzle-13-01.cc | 8 ++++---- 2016/puzzle-13-02.cc | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/2016/puzzle-13-01.cc b/2016/puzzle-13-01.cc index bd1443f..8a5391d 100644 --- a/2016/puzzle-13-01.cc +++ b/2016/puzzle-13-01.cc @@ -19,9 +19,9 @@ struct Node return x_ < rhs.x_ || (x_ == rhs.x_ && y_ < rhs.y_); } - Num x() const noexcept { return x_; } - Num y() const noexcept { return y_; } - Num cost() const noexcept { return cost_; } + constexpr Num y() const noexcept { return y_; } + constexpr Num x() const noexcept { return x_; } + constexpr Num cost() const noexcept { return cost_; } Node move_left() { return {x_ - 1, y_, cost_ + 1}; } Node move_up() { return {x_, y_ + 1, cost_ + 1}; } @@ -112,4 +112,4 @@ auto main() -> int std::cout << "No solution.\n"; return 1; -} \ No newline at end of file +} diff --git a/2016/puzzle-13-02.cc b/2016/puzzle-13-02.cc index 60a4ca8..78955f0 100644 --- a/2016/puzzle-13-02.cc +++ b/2016/puzzle-13-02.cc @@ -19,9 +19,9 @@ struct Node return x_ < rhs.x_ || (x_ == rhs.x_ && y_ < rhs.y_); } - Num x() const noexcept { return x_; } - Num y() const noexcept { return y_; } - Num cost() const noexcept { return cost_; } + constexpr Num x() const noexcept { return x_; } + constexpr Num y() const noexcept { return y_; } + constexpr Num cost() const noexcept { return cost_; } Node move_left() { return {x_ - 1, y_, cost_ + 1}; } Node move_up() { return {x_, y_ + 1, cost_ + 1}; } @@ -112,4 +112,4 @@ auto main() -> int std::cout << "Number of visited locations: " << visited.size() << '\n'; return 0; -} \ No newline at end of file +}