mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-09 23:59:27 +01:00
DiscIO/Volume: Make Partition's interface constexpr
PARTITION_NONE technically has a runtime static constructor otherwise. This allows compile-time instances of Partition to be created without the use of a static constructor.
This commit is contained in:
parent
c70da390a7
commit
db3b31c246
@ -26,18 +26,18 @@ class VolumeWAD;
|
||||
|
||||
struct Partition final
|
||||
{
|
||||
Partition() : offset(std::numeric_limits<u64>::max()) {}
|
||||
explicit Partition(u64 offset_) : offset(offset_) {}
|
||||
bool operator==(const Partition& other) const { return offset == other.offset; }
|
||||
bool operator!=(const Partition& other) const { return !(*this == other); }
|
||||
bool operator<(const Partition& other) const { return offset < other.offset; }
|
||||
bool operator>(const Partition& other) const { return other < *this; }
|
||||
bool operator<=(const Partition& other) const { return !(*this < other); }
|
||||
bool operator>=(const Partition& other) const { return !(*this > other); }
|
||||
u64 offset;
|
||||
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); }
|
||||
constexpr bool operator>=(const Partition& other) const { return !(*this > other); }
|
||||
u64 offset{std::numeric_limits<u64>::max()};
|
||||
};
|
||||
|
||||
const Partition PARTITION_NONE(std::numeric_limits<u64>::max() - 1);
|
||||
constexpr Partition PARTITION_NONE(std::numeric_limits<u64>::max() - 1);
|
||||
|
||||
class Volume
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user