File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -249,6 +249,8 @@ Json::Value arr_value(Json::arrayValue); // []
249
249
Json::Value obj_value(Json::objectValue); // {}
250
250
\endcode
251
251
*/
252
+ struct StaticInitTag {};
253
+ Value (StaticInitTag);
252
254
Value (ValueType type = nullValue);
253
255
Value (Int value);
254
256
Value (UInt value);
Original file line number Diff line number Diff line change @@ -33,9 +33,9 @@ namespace Json {
33
33
const Value Value::null;
34
34
#define ALIGNAS (byte_alignment )
35
35
#endif
36
- static const unsigned char ALIGNAS ( 8 ) kNull [ sizeof ( Value)] = { 0 } ;
37
- const Value& Value::null = reinterpret_cast < const Value&>( kNull [ 0 ]) ;
38
- const Value& Value::nullRef = reinterpret_cast < const Value&>( kNull [ 0 ]) ;
36
+ static const Value kNull (( Value::StaticInitTag ())) ;
37
+ const Value& Value::null = kNull ;
38
+ const Value& Value::nullRef = kNull ;
39
39
40
40
const Int Value::minInt = Int (~(UInt (-1 ) / 2 ));
41
41
const Int Value::maxInt = Int (UInt (-1 ) / 2 );
@@ -309,6 +309,8 @@ bool Value::CZString::isStaticString() const { return storage_.policy_ == noDupl
309
309
// //////////////////////////////////////////////////////////////////
310
310
// //////////////////////////////////////////////////////////////////
311
311
312
+ Value::Value (Value::StaticInitTag) {}
313
+
312
314
/* ! \internal Default constructor initialization must be equivalent to:
313
315
* memset( this, 0, sizeof(Value) )
314
316
* This optimization is used in ValueInternalMap fast allocator.
You can’t perform that action at this time.
0 commit comments