Open Talkless opened 1 year ago
You might want to report a Qt bug about this. Then there's an elevated chance that I'll assign it to myself and fix it.
..except I might not be able to, since these problems where the result of operator- between operators is not the same as the container's difference_type are baked in the ABI.
..or if it's caused by the funny operator- that returns an iterator, that's also ABI-baked.
Okay then. This is caused by qt5 having the wrong difference_type for the iterator, which is not the same as the result of operator-. That's also ABI-baked.
@villevoutilainen so if it's (ever) fixed, it's only for Qt 7..? :/
Qt 6 is fine - there the iterator's difference_type and the result of operator- are the same, qsizetype. I was mistaken to talk about the container's difference_type above, that's not used. So this has been fixed in Qt 6, but fixing it in Qt 5 may prove to be.. ..difficult.
Oh, I forgot that I was using... Thanks @villevoutilainen .
I guess we can close this, as it's not ranges issue?
Debian 11 gcc (Debian 10.2.1-6) Ranges 0.11.0 Qt 5.15.10 -std=gnu++2a
If I have code like this:
I get:
But
std::sort(l.begin(), l.end())
works.For some reason
ranges::sort
does not "like"QList<>::iterator
?Qt docs states that it's random access iterator: https://doc.qt.io/qt-5/qlist-iterator.html#iterator_category-typedef