C++20: Synthesize operator!= From operator==

The inequality operator is automatically generated by the compiler if `operator==` is defined.
This commit is contained in:
mitaclaw
2024-10-10 20:23:55 -07:00
parent b5f7a50874
commit e8d5fb89e4
36 changed files with 0 additions and 101 deletions
-1
View File
@@ -20,7 +20,6 @@ struct ConfigChangedCallbackID
size_t id = -1;
bool operator==(const ConfigChangedCallbackID&) const = default;
bool operator!=(const ConfigChangedCallbackID&) const = default;
};
using ConfigChangedCallback = std::function<void()>;
-5
View File
@@ -15,11 +15,6 @@ bool Location::operator==(const Location& other) const
strcasecmp(key.c_str(), other.key.c_str()) == 0;
}
bool Location::operator!=(const Location& other) const
{
return !(*this == other);
}
bool Location::operator<(const Location& other) const
{
if (system != other.system)
-1
View File
@@ -28,7 +28,6 @@ struct Location
std::string key;
bool operator==(const Location& other) const;
bool operator!=(const Location& other) const;
bool operator<(const Location& other) const;
};
-1
View File
@@ -122,7 +122,6 @@ struct OpArg
return std::tie(scale, offsetOrBaseReg, indexReg, offset, operandReg) ==
std::tie(b.scale, b.offsetOrBaseReg, b.indexReg, b.offset, b.operandReg);
}
constexpr bool operator!=(const OpArg& b) const { return !operator==(b); }
u64 Imm64() const
{
DEBUG_ASSERT(scale == SCALE_IMM64);
@@ -16,7 +16,6 @@ struct ConfigChangedCallbackID
size_t id = -1;
bool operator==(const ConfigChangedCallbackID&) const = default;
bool operator!=(const ConfigChangedCallbackID&) const = default;
};
// returns an ID that can be passed to RemoveConfigChangedCallback()
-10
View File
@@ -30,21 +30,11 @@ bool operator==(const GeckoCode& lhs, const GeckoCode& rhs)
return lhs.codes == rhs.codes;
}
bool operator!=(const GeckoCode& lhs, const GeckoCode& rhs)
{
return !operator==(lhs, rhs);
}
bool operator==(const GeckoCode::Code& lhs, const GeckoCode::Code& rhs)
{
return std::tie(lhs.address, lhs.data) == std::tie(rhs.address, rhs.data);
}
bool operator!=(const GeckoCode::Code& lhs, const GeckoCode::Code& rhs)
{
return !operator==(lhs, rhs);
}
enum class Installation
{
Uninstalled,
-2
View File
@@ -39,10 +39,8 @@ public:
};
bool operator==(const GeckoCode& lhs, const GeckoCode& rhs);
bool operator!=(const GeckoCode& lhs, const GeckoCode& rhs);
bool operator==(const GeckoCode::Code& lhs, const GeckoCode::Code& rhs);
bool operator!=(const GeckoCode::Code& lhs, const GeckoCode::Code& rhs);
// Installation address for codehandler.bin in the Game's RAM
constexpr u32 INSTALLER_BASE_ADDRESS = 0x80001800;
@@ -1228,11 +1228,6 @@ bool operator==(const HeaderData& lhs, const HeaderData& rhs)
return std::memcmp(&lhs, &rhs, sizeof(HeaderData)) == 0;
}
bool operator!=(const HeaderData& lhs, const HeaderData& rhs)
{
return !(lhs == rhs);
}
Header::Header(const CardFlashId& flash_id, u16 size_mbits, bool shift_jis, u32 rtc_bias,
u32 sram_language, u64 format_time)
{
@@ -192,7 +192,6 @@ void InitializeHeaderData(HeaderData* data, const CardFlashId& flash_id, u16 siz
bool shift_jis, u32 rtc_bias, u32 sram_language, u64 format_time);
bool operator==(const HeaderData& lhs, const HeaderData& rhs);
bool operator!=(const HeaderData& lhs, const HeaderData& rhs);
struct Header
{
-1
View File
@@ -30,7 +30,6 @@ struct CameraPoint
{
return this->position == other.position && this->size == other.size;
}
constexpr bool operator!=(const CameraPoint& other) const { return !(*this == other); }
};
// Four bytes for two objects. Filled with 0xFF if empty
-5
View File
@@ -73,11 +73,6 @@ bool operator==(const Content& lhs, const Content& rhs)
return fields(lhs) == fields(rhs);
}
bool operator!=(const Content& lhs, const Content& rhs)
{
return !operator==(lhs, rhs);
}
SignedBlobReader::SignedBlobReader(std::vector<u8> bytes) : m_bytes(std::move(bytes))
{
}
-1
View File
@@ -101,7 +101,6 @@ struct Content
};
static_assert(sizeof(Content) == 36, "Content has the wrong size");
bool operator==(const Content&, const Content&);
bool operator!=(const Content&, const Content&);
struct TimeLimit
{
-10
View File
@@ -91,11 +91,6 @@ inline bool operator==(const Modes& lhs, const Modes& rhs)
return fields(lhs) == fields(rhs);
}
inline bool operator!=(const Modes& lhs, const Modes& rhs)
{
return !(lhs == rhs);
}
struct Metadata
{
Uid uid;
@@ -190,11 +185,6 @@ inline bool operator==(const SplitPathResult& lhs, const SplitPathResult& rhs)
return fields(lhs) == fields(rhs);
}
inline bool operator!=(const SplitPathResult& lhs, const SplitPathResult& rhs)
{
return !(lhs == rhs);
}
/// Split a path into a parent path and the file name. Takes a *valid non-root* path.
///
/// Example: /shared2/sys/SYSCONF => {/shared2/sys, SYSCONF}
@@ -151,7 +151,6 @@ public:
Arm64Gen::ARM64Reg GetReg() const { return m_reg; }
bool operator==(Arm64Gen::ARM64Reg reg) const { return reg == m_reg; }
bool operator!=(Arm64Gen::ARM64Reg reg) const { return !operator==(reg); }
private:
Arm64Gen::ARM64Reg m_reg = Arm64Gen::ARM64Reg::INVALID_REG;
-1
View File
@@ -140,7 +140,6 @@ public:
bool Read(u64* offset, u64* length, u8** buffer, DirectoryBlobReader* blob) const;
bool operator==(const DiscContent& other) const { return GetEndOffset() == other.GetEndOffset(); }
bool operator!=(const DiscContent& other) const { return !(*this == other); }
bool operator<(const DiscContent& other) const { return GetEndOffset() < other.GetEndOffset(); }
bool operator>(const DiscContent& other) const { return other < *this; }
bool operator<=(const DiscContent& other) const { return !(*this > other); }
-2
View File
@@ -60,7 +60,6 @@ public:
{
return m_file_info ? (it.m_file_info && *m_file_info == *it.m_file_info) : (!it.m_file_info);
}
bool operator!=(const const_iterator& it) const { return !operator==(it); }
// Incrementing or destroying an iterator will invalidate its returned references and
// pointers, but will not invalidate copies of the iterator or file info object.
const FileInfo& operator*() const { return *m_file_info.get(); }
@@ -73,7 +72,6 @@ public:
virtual ~FileInfo();
bool operator==(const FileInfo& other) const { return GetAddress() == other.GetAddress(); }
bool operator!=(const FileInfo& other) const { return !operator==(other); }
virtual std::unique_ptr<FileInfo> clone() const = 0;
virtual const_iterator cbegin() const { return begin(); }
virtual const_iterator cend() const { return end(); }
-1
View File
@@ -32,7 +32,6 @@ struct Partition final
constexpr Partition() = default;
constexpr explicit Partition(u64 offset_) : offset(offset_) {}
constexpr bool operator==(const Partition& other) const { return offset == other.offset; }
constexpr bool operator!=(const Partition& other) const { return !(*this == other); }
constexpr bool operator<(const Partition& other) const { return offset < other.offset; }
constexpr bool operator>(const Partition& other) const { return other < *this; }
constexpr bool operator<=(const Partition& other) const { return !(*this < other); }
-1
View File
@@ -264,7 +264,6 @@ private:
std::tie(other.partition_key, other.data_size, other.encrypted, other.value);
}
bool operator!=(const ReuseID& other) const { return !operator==(other); }
bool operator>=(const ReuseID& other) const { return !operator<(other); }
bool operator<=(const ReuseID& other) const { return !operator>(other); }
-1
View File
@@ -80,7 +80,6 @@ public:
// Needed for InputIterator concept
bool operator==(const MoIterator& other) const { return distance_to(other) == 0; }
bool operator!=(const MoIterator& other) const { return !(*this == other); }
pointer operator->() const { return dereference(); }
MoIterator operator++(int)
{
@@ -227,21 +227,11 @@ bool DeviceQualifier::operator==(const Device* const dev) const
return false;
}
bool DeviceQualifier::operator!=(const Device* const dev) const
{
return !operator==(dev);
}
bool DeviceQualifier::operator==(const DeviceQualifier& devq) const
{
return std::tie(cid, name, source) == std::tie(devq.cid, devq.name, devq.source);
}
bool DeviceQualifier::operator!=(const DeviceQualifier& devq) const
{
return !operator==(devq);
}
std::shared_ptr<Device> DeviceContainer::FindDevice(const DeviceQualifier& devq) const
{
std::lock_guard lk(m_devices_mutex);

Some files were not shown because too many files have changed in this diff Show More