From c378f089b4f946d4afc4045c4903fb12e0942dd4 Mon Sep 17 00:00:00 2001 From: MikeGitb Date: Tue, 20 Sep 2016 18:06:48 +0200 Subject: [PATCH] Add relational comparison operators to byte --- gsl/gsl_byte | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gsl/gsl_byte b/gsl/gsl_byte index 90885f9..00b4b15 100644 --- a/gsl/gsl_byte +++ b/gsl/gsl_byte @@ -111,10 +111,15 @@ inline constexpr byte to_byte() noexcept // use of byte within span<> to be standards-compliant struct byte { unsigned char v; + explicit operator unsigned char&() { return v; } explicit operator const unsigned char&() const { return v; } friend bool operator==(byte l, byte r) { return l.v == r.v; } friend bool operator!=(byte l, byte r) { return l.v != r.v; } + friend bool operator<(byte l, byte r) { return l.v < r.v; } + friend bool operator<=(byte l, byte r) { return l.v <= r.v; } + friend bool operator>(byte l, byte r) { return l.v > r.v; } + friend bool operator>=(byte l, byte r) { return l.v >= r.v; } }; template ::value>>