Common/Swap: Amend BigEndianValue's operator= to return a reference to the object rather than returning void

The general convention is to return a reference to the object that was
acted on, otherwise you can get into situations with errors because the
type wasn't being propagated properly
This commit is contained in:
Lioncash 2018-04-07 22:50:03 -04:00
parent 75574b7b97
commit 88a80f118c
1 changed files with 6 additions and 1 deletions

View File

@ -174,7 +174,12 @@ struct BigEndianValue
BigEndianValue() = default;
explicit BigEndianValue(value_type val) { *this = val; }
operator value_type() const { return FromBigEndian(raw); }
void operator=(value_type v) { raw = FromBigEndian(v); }
BigEndianValue& operator=(value_type v)
{
raw = FromBigEndian(v);
return *this;
}
private:
value_type raw;
};