Add constexpr to some functions.

Fixes Linux build failures.
This commit is contained in:
2021-12-09 13:55:29 +00:00
parent 802adbb317
commit 02a57907ec
2 changed files with 8 additions and 8 deletions

View File

@@ -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;
}
}

View File

@@ -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;
}
}