Make Value copy constructor simplier
Helper private methods Value::dupPayload() and Value::dupMeta() are added.
Value copy constructor doesn't attempt to delete its data first.
* Value::dupPayload() duplicates a payload.
* Value::dupMeta() duplicates comments and an offset position with a limit.
diff --git a/include/json/value.h b/include/json/value.h
index 1643210..bcf3675 100644
--- a/include/json/value.h
+++ b/include/json/value.h
@@ -606,7 +606,9 @@
private:
void initBasic(ValueType type, bool allocated = false);
+ void dupPayload(const Value& other);
void releasePayload();
+ void dupMeta(const Value& other);
Value& resolveReference(const char* key);
Value& resolveReference(const char* key, const char* end);