Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-328

[C++] Return shared_ptr by value instead of const-ref?

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 0.2.0
    • C++
    • None

    Description

      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.

      Attachments

        Activity

          People

            wesm Wes McKinney
            wesm Wes McKinney
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: