Skip to content

Commit 6c3a4b6

Browse files
hchunhuicdunn2001
authored andcommitted
Make the special constructor private.
1 parent ce85e67 commit 6c3a4b6

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

include/json/value.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,12 @@ class JSON_API Value {
233233
#endif // ifndef JSON_USE_CPPTL_SMALLMAP
234234
#endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
235235

236-
public:
236+
private:
237237
struct StaticInitTag {};
238-
Value(StaticInitTag); ///< A special constructor for Value::null.
238+
Value(StaticInitTag); ///< A special constructor for Value::kNull.
239+
static const Value kNull;
240+
241+
public:
239242
/** \brief Create a default Value of the given type.
240243
241244
This is a very useful constructor.

src/lib_json/json_value.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323

2424
namespace Json {
2525

26-
static const Value kNull((Value::StaticInitTag()));
27-
const Value& Value::null = kNull;
28-
const Value& Value::nullRef = kNull;
26+
const Value Value::kNull((Value::StaticInitTag()));
27+
const Value& Value::null = Value::kNull;
28+
const Value& Value::nullRef = Value::kNull;
2929

3030
const Int Value::minInt = Int(~(UInt(-1) / 2));
3131
const Int Value::maxInt = Int(UInt(-1) / 2);

0 commit comments

Comments
 (0)