void touch() duplicates the logic of void set_root(const std::shared_ptr<json>& item) and void set_parent(const std::shared_ptr<json>& local): for non-dynamic jsons it makes no sense to call touch() and traverse the whole object, so it is worth considering combining set_parent and set_root, getting rid of touch. When traversing it is enough to look at json_reference and if head is_local - use set_parent logic, otherwise - set_root.
Additionally: add bool is_local() as a method for json_reference.
void touch()
duplicates the logic ofvoid set_root(const std::shared_ptr<json>& item)
andvoid set_parent(const std::shared_ptr<json>& local)
: for non-dynamic jsons it makes no sense to calltouch()
and traverse the whole object, so it is worth considering combiningset_parent
andset_root
, getting rid oftouch
. When traversing it is enough to look atjson_reference
and if headis_local
- useset_parent
logic, otherwise -set_root
. Additionally: addbool is_local()
as a method forjson_reference
.