From 88a80f118c3170cae82f11a48577a41b1a84a332 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 7 Apr 2018 22:50:03 -0400 Subject: [PATCH] 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 --- Source/Core/Common/Swap.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/Core/Common/Swap.h b/Source/Core/Common/Swap.h index 207faac93c..09276af3e4 100644 --- a/Source/Core/Common/Swap.h +++ b/Source/Core/Common/Swap.h @@ -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; };