summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2024-03-16 18:41:27 -0700
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-03-19 17:23:00 +0000
commit1e11f8fa80e5bbce11d0dfe7213d8af1e8c10fe3 (patch)
tree2365e983a13ad04dab7b415e7e7ebad52363f3dd /src
parenteb82e4437a5a8fb8b9af4f17c7e8ab32d18fe21b (diff)
QDBusArgument: disambiguate between QMap on std::pair and std::map
For QMap on a std::pair, QMap::iterator{}.operator->() would result in a type that has "first" and "second" members: std::pair itself. But it would be wrong to marshall and demarshall the first and second elements thereof as the key and value, so give preference to the .key() and .value() selection, which would store the std::pair as the type. Fixes: QTBUG-123401 Pick-to: 6.5 Change-Id: I6818d78a57394e37857bfffd17bd69bb692dd03b Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit 5401a9a6cd3263eda15911c3fbfc81ebea2e798f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 9ffed81b159e9bdf4aba26dfdbd08ff508ffe8b3)
Diffstat (limited to 'src')
-rw-r--r--src/corelib/tools/qcontainertools_impl.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/corelib/tools/qcontainertools_impl.h b/src/corelib/tools/qcontainertools_impl.h
index 40ed0a84e9..280bb585c2 100644
--- a/src/corelib/tools/qcontainertools_impl.h
+++ b/src/corelib/tools/qcontainertools_impl.h
@@ -300,7 +300,11 @@ using IfAssociativeIteratorHasKeyAndValue =
template <typename Iterator>
using IfAssociativeIteratorHasFirstAndSecond =
- std::enable_if_t<qxp::is_detected_v<FirstAndSecondTest, Iterator>, bool>;
+ std::enable_if_t<
+ std::conjunction_v<
+ std::negation<qxp::is_detected<KeyAndValueTest, Iterator>>,
+ qxp::is_detected<FirstAndSecondTest, Iterator>
+ >, bool>;
template <typename Iterator>
using MoveBackwardsTest = decltype(