[mythtv] QString: pass by const& or value?
Scott T
scott.the.elm at gmail.com
Thu Oct 21 04:45:29 UTC 2021
Is it necessary to pass QString by const reference? Specifically I'm
looking at libmythmetadata/videometadata (converting to non-PIMPL) and
libmyth/programinfo (some unchanged by
https://github.com/MythTV/mythtv/commit/1a8097e3249a8ed2ea051056da08a35993bdc953
)
If I understand correctly, passing by value increments the reference
counter before the function call, and then using std::move just moves
the (pointer to the) data. Thus, passing by value is recommended for
constructors.
Should other functions also be passed by value, due to Qt’s implicit
sharing? Should QStrings be returned from a function by value or const
reference as many are in videometadata?
Thanks,
Scott
More information about the mythtv-dev
mailing list