Browse Source

Fix compiler warnings about Optional field initialization order

Alex Szpakowski 6 năm trước cách đây
mục cha
commit
3938da9cc6
1 tập tin đã thay đổi với 5 bổ sung5 xóa
  1. 5 5
      src/common/Optional.h

+ 5 - 5
src/common/Optional.h

@@ -31,19 +31,19 @@ struct Optional
 	bool hasValue;
 
 	Optional()
-		: hasValue(false)
-		, value(T())
+		: value(T())
+		, hasValue(false)
 	{}
 
 	Optional(T val)
-		: hasValue(true)
-		, value(val)
+		: value(val)
+		, hasValue(true)
 	{}
 
 	void set(T val)
 	{
-		hasValue = true;
 		value = val;
+		hasValue = true;
 	}
 };