[
https://issues.apache.org/jira/browse/MINIFICPP-515?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16529571#comment-16529571
]
ASF GitHub Bot commented on MINIFICPP-515:
------------------------------------------
Github user achristianson commented on the issue:
https://github.com/apache/nifi-minifi-cpp/pull/359
@phrocker I read through the blog post.
The high level objective of this PR is to achieve the "copy free" state.
The push_back( T&& value ) is what we want.
"in general push_back of already constructed objects with a move
constructor should be fine"
It would copy, because the string is still valid after we add it (this
would be "Case B" from the article):
"Case B is not affected (it still copies), and that's good, because we
want to print s1 to cout below, so we want that data there."
"Case G" is the fit here, since the strings would still be valid. We need
std::move to say that we're done with the string in this scope and it's OK for
it to go into arbitrary post-move state.
I'll update to call push_back( T&& value ) which should be copy-free and is
appropriate because we're not constructing an object.
> Implement emplace_back for values in Property class
> ---------------------------------------------------
>
> Key: MINIFICPP-515
> URL: https://issues.apache.org/jira/browse/MINIFICPP-515
> Project: NiFi MiNiFi C++
> Issue Type: Improvement
> Reporter: Andrew Christianson
> Assignee: Andrew Christianson
> Priority: Major
>
> We're calling push_back instead of emplace_back, as well as unnecessarily
> rebuilding strings from c_string() values.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)