Added < boolean operator overload for TargetRegisterDescriptors

This commit is contained in:
Nav
2021-08-21 21:11:36 +01:00
parent 092a7df675
commit 4b76a41076

View File

@@ -36,6 +36,15 @@ namespace Bloom::Targets
bool operator == (const TargetRegisterDescriptor& other) const { bool operator == (const TargetRegisterDescriptor& other) const {
return this->startAddress.value_or(0) == other.startAddress.value_or(0) && this->type == other.type; return this->startAddress.value_or(0) == other.startAddress.value_or(0) && this->type == other.type;
} }
bool operator < (const TargetRegisterDescriptor& other) const {
if (this->startAddress.has_value() && other.startAddress.has_value()) {
return this->startAddress.value_or(0) < other.startAddress.value_or(0);
} else {
return this->name.value_or("") < other.name.value_or("");
}
}
}; };
struct TargetRegister struct TargetRegister