Skip to content

Commit

Permalink
Add constexpr specifier for Coordinate constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
dxrcy committed Oct 29, 2024
1 parent 90a05e2 commit e6430db
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions include/mcpp/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ struct Coordinate {
* @param y The y-coordinate.
* @param z The z-coordinate.
*/
Coordinate(int x, int y, int z) : x(x), y(y), z(z) {}
constexpr Coordinate(int x, int y, int z) : x(x), y(y), z(z) {}

/**
* @brief Constructs a Coordinate object with zero values.
*/
Coordinate() : x(0), y(0), z(0) {}
constexpr Coordinate() : x(0), y(0), z(0) {}

/**
* @brief Constructs a Coordinate object with double values.
Expand All @@ -37,7 +37,7 @@ struct Coordinate {
* @param y The y-coordinate as a double.
* @param z The z-coordinate as a double.
*/
Coordinate(double x, double y, double z)
constexpr Coordinate(double x, double y, double z)
: x(static_cast<int>(x)), y(static_cast<int>(y)),
z(static_cast<int>(z)) {}

Expand Down

0 comments on commit e6430db

Please sign in to comment.