Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-25790

"Generate getter" - better options to avoid undesired const ref return type

    XMLWordPrintable

    Details

    • Type: Suggestion
    • Status: Reported
    • Priority: Not Evaluated
    • Resolution: Unresolved
    • Affects Version/s: Qt Creator 4.15.0
    • Fix Version/s: None
    • Component/s: C/C++/Obj-C++ Support
    • Labels:
      None
    • Platform/s:
      Windows

      Description

      I have a large project with thousands of classes. Almost all classes which are passed via getters/setters are copyable by value (small or implicitly shared).

      Whenever I use "Generate getter and setter" and similar refactoring methods, I have to manually correct the returned const ref. On the other hand, managing the hundreds of custom value classes in Creator's settings just isn't feasible.

      Why not offer a setting to "return by value" by default?

      Or some intelligence that any copyable object will be returned by value, and only non-copyable objects will be returned by reference?

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            kandeler Christian Kandeler
            Reporter:
            asperamanca Robert Schimkowitsch
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes