Add constexpr to some functions.
Fixes Linux build failures.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user