mirror of
https://github.com/kierankihn/uno-game.git
synced 2025-12-27 02:13:18 +08:00
feat(game): add operator< for Card
This commit is contained in:
@@ -68,4 +68,11 @@ namespace UNO::GAME {
|
||||
}
|
||||
return std::format("{} {}", this->colorToString(), this->typeToString());
|
||||
}
|
||||
|
||||
bool Card::operator<(const Card &other) const {
|
||||
if (this->color_ != other.color_) {
|
||||
return this->color_ < other.color_;
|
||||
}
|
||||
return this->type_ < other.type_;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user