On 20/09/18 12:43, Michal Lazo wrote:
"So my whole C++ world just changed." Can you point me to right article in C++ documentation ?
http://eel.is/c++draft/over.matchSee in particular [over.match.funcs] ยง11.3.1.4 , and then you need to reason about the implications for the overload resolution.
So Qt devs I found some code for example http://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/text/qtextcursor.cpp#n1151 And it looks like it should be better to call const variant what do you think ??
Possibly, but what's the big drama about that line?It's not a mistery that QSharedDataPointer is very prone to "accidental" detaches, so its usage is frowned upon in new code, in favour of QExplictlySharedDataPointer (which however requires manual calls to detach(), and one needs to remember about them).
For instance, in a setter such as
void MyClass::setFoo(int newFoo) { if (d->foo == newFoo) return; d->foo = newFoo; }
(assuming d is a QSharedDataPointer<MyClassPrivate>) the d->foo access in the if is supposed to be "readonly", yet it happily detaches the private, even if the new value passed to the setter is identical to the old value and thus one might expect that nothing needs to be done.
(No, noone is porting QTextCursor away from QSharedDataPointer at this moment in time.)
My 2 c, -- Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Senior Software Engineer KDAB (France) S.A.S., a KDAB Group company Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com KDAB - The Qt, C++ and OpenGL Experts
smime.p7s
Description: S/MIME Cryptographic Signature
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest