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:
parent
75574b7b97
commit
88a80f118c
|
@ -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;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue