You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Rok Mihevc (Jira)" <ji...@apache.org> on 2023/01/11 07:09:02 UTC
[jira] [Commented] (ARROW-328) [C++] Return shared_ptr by value instead of const-ref?
[ https://issues.apache.org/jira/browse/ARROW-328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17657362#comment-17657362 ]
Rok Mihevc commented on ARROW-328:
----------------------------------
This issue has been migrated to [issue #15326|https://github.com/apache/arrow/issues/15326] on GitHub. Please see the [migration documentation|https://github.com/apache/arrow/issues/14542] for further details.
> [C++] Return shared_ptr by value instead of const-ref?
> ------------------------------------------------------
>
> Key: ARROW-328
> URL: https://issues.apache.org/jira/browse/ARROW-328
> Project: Apache Arrow
> Issue Type: Improvement
> Components: C++
> Reporter: Wes McKinney
> Assignee: Wes McKinney
> Priority: Major
> Fix For: 0.2.0
>
>
> This is largely my fault but: many C++ programmers seem to feel that you should always return {{std::shared_ptr}} by value for a couple reasons:
> * RVO in many cases prevents a double ref-count manipulation and,
> * If you are planning to share ownership with the other class, you will need to copy the shared_ptr anyway
> On some contemplation I'm +1 on changing all {{const std::shared_ptr<T>&}} to {{std::shared_ptr<T>}}, but let me know if there are other opinions.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)