Add operators to ByteSize
This commit is contained in:
@@ -132,6 +132,17 @@ namespace OpenVulkano
|
||||
constexpr operator uint64_t() const { return bytes; }
|
||||
|
||||
operator std::string() const { return Format(); }
|
||||
|
||||
ByteSize operator +(const ByteSize other) const { return bytes + other.bytes; }
|
||||
ByteSize operator -(const ByteSize other) const { return bytes + other.bytes; }
|
||||
ByteSize operator +(const size_t other) const { return bytes + other; }
|
||||
ByteSize operator -(const size_t other) const { return bytes + other; }
|
||||
ByteSize& operator =(const size_t other) { bytes = other; return *this; }
|
||||
ByteSize& operator =(const ByteSize other) { bytes = other.bytes; return *this; }
|
||||
ByteSize& operator +=(const size_t other) { bytes += other; return *this; }
|
||||
ByteSize& operator +=(const ByteSize other) { bytes += other.bytes; return *this; }
|
||||
ByteSize& operator -=(const size_t other) { bytes -= other; return *this; }
|
||||
ByteSize& operator -=(const ByteSize other) { bytes -= other.bytes; return *this; }
|
||||
};
|
||||
|
||||
inline constexpr ByteSize operator"" _kiB(long double num) { return { num, ByteSizeUnit::kiB }; }
|
||||
@@ -174,4 +185,4 @@ template<> struct fmt::formatter<OpenVulkano::ByteSize>
|
||||
return fmt::format_to(ctx.out(), "{}", bs.Format());
|
||||
}
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user