-
Notifications
You must be signed in to change notification settings - Fork 144
feat: support assign json #286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
看不太懂这个是支持的什么功能。我们之前不支持json["key"] = another_json 这样的写法么? |
|
是的,之前不支持 |
|
这个做法,是否有内存泄露的可能性呢?例如,如果用于赋值的another_json是一个中间节点会怎么样?
…------------------ Original ------------------
From: PhoenixChen98 ***@***.***>
Date: Sun,Jun 1,2025 8:26 PM
To: wfrest/wfrest ***@***.***>
Cc: xiehan ***@***.***>, Comment ***@***.***>
Subject: Re: [wfrest/wfrest] feat: support assign json (PR #286)
PhoenixChen98 left a comment (wfrest/wfrest#286)
是的,之前不支持
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
|
|
我是调用的已有方法,里面是copy的,应该没内存泄露风险 |
| } | ||
| if (parent_ != nullptr) | ||
| { | ||
| assign(other); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里不用std::move() ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
哦对,我改下
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
然后也没有右值的assign接口好像。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
其实update_arr和push_back等一系列方法也都没有右值接口,我这里加上move意义也不大了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
但是这样语义上有点不对了。感觉是可以实现的,我想想。
support assign json such as:
json["key"] = jsonObject;