summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2025-12-10 16:45:07 +0100
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2025-12-12 00:11:11 +0100
commitcfc555bc4d35fc460fd8f963e7ed50f0dd2cb4e4 (patch)
tree92832ade7a165c1294347ffbc80459e14656e83f
parentf9df77043a891c3089de5c47d53b369b64121795 (diff)
QRM: simplify detecting whether we can rotate
Use std::is_swappable instead of rolling our own. Amends 2812579a667036eafcf238def42687ca2388e21f Pick-to: 6.11 6.10 Change-Id: I688b7b9eba702dd3e60a03d3df86392eaaec0d4f Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
-rw-r--r--src/corelib/itemmodels/qrangemodel_impl.h18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/corelib/itemmodels/qrangemodel_impl.h b/src/corelib/itemmodels/qrangemodel_impl.h
index f6b08099fe7..7eca3094a66 100644
--- a/src/corelib/itemmodels/qrangemodel_impl.h
+++ b/src/corelib/itemmodels/qrangemodel_impl.h
@@ -239,17 +239,15 @@ namespace QRangeModelDetails
: std::true_type
{};
- // we use std::rotate in moveRows/Columns, which requires std::swap and the
- // iterators to be at least a forward iterator
- template <typename It, typename = void>
- struct test_rotate : std::false_type {};
-
+ // we use std::rotate in moveRows/Columns, which requires the values (which
+ // might be const if we only get a const iterator) to be swappable, and the
+ // iterator type to be at least a forward iterator
template <typename It>
- struct test_rotate<It, std::void_t<decltype(std::swap(*std::declval<It>(),
- *std::declval<It>()))>>
- : std::is_base_of<std::forward_iterator_tag,
- typename std::iterator_traits<It>::iterator_category>
- {};
+ using test_rotate = std::conjunction<
+ std::is_swappable<decltype(*std::declval<It>())>,
+ std::is_base_of<std::forward_iterator_tag,
+ typename std::iterator_traits<It>::iterator_category>
+ >;
template <typename C, typename = void>
struct test_splice : std::false_type {};