summaryrefslogtreecommitdiffstats
path: root/src/network/access/qnetworkrequest.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2023-11-22 13:23:31 +0100
committerTatiana Borisova <tatiana.borisova@qt.io>2024-05-24 20:17:46 +0000
commitece36a7394594ede3fba6744fb8f5b450a477652 (patch)
tree607418a7a6887c393a1c92016b5c502882a4607a /src/network/access/qnetworkrequest.cpp
parent5fe166ab41ed3d5f1755dca2a0a20f3dd6598008 (diff)
Port QModelIndex to new comparison helper macros
Use Milian's asTuple() trick and compareThreeWayMulti(). The pointer variable presents a challenge, because, like op<, op<=> cannot order unrelated pointer values. Trying to is UB; one is supposed to use std::less and std::compare_three_way instead, but, you guessed it, less<tuple<T*>> uses op< to compare the tuples, which, in turn uses op< on the T* member, causing UB. [ChangeLog][QtCore][QtCompare] Added a Qt::totally_ordered_wrapper class whose relational operators use the std ordering types. Use it to wrap the pointers when doing the comparison to avoid UB. This allows a smooth migration once we depend on C++20 and class authors start using lhs.asTuple() <=> rhs.asTuple() or even start to =default op<=>. The wrapper type is robust against all these transformations. Update QModelIndex comparison documentation part. Task-number: QTBUG-117660 Change-Id: I126b2ebff458800134ed6e774a389d85d76a395f Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'src/network/access/qnetworkrequest.cpp')
0 files changed, 0 insertions, 0 deletions