Details
-
User Story
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
None
-
21
-
Foundation PM Staging
Description
Traditionally, QDebug has been copyable¹, with the Stream (non-atomically) ref-counted. We should consider making QDebug move-only in order to get rid of the ref-counting. The problem is that your usual d << val1 then won't work anymore, because d (having a name) is an lvalue (you need to say d = std::move(d) << val instead). This is really only a problem for op<< implementations, your usual qDebug() << ... user chain is unaffected (except for smaller executable code size).
¹ mainly to facilitate passing it into and out of streaming operators, which cannot use pass-by-(lvalue-)reference, because qDebug() return an (r)value, which doesn't bind to lvalue references.
Maybe we can at least create an opt-in and make sure all of our code never copies. While we won't get rid of ref-counting that way, we can at least get rid of the code upping and downing it, for our implementations, and so make ref > 1 [[unlikely]].