QDebug: constrain the new Standard Library op<<

So they be SFINAE-ruled out when either the key or (for associative
containers) value types don't provide their debug-streaming operators
either.

Amends 850d4895be565931d18c92e5e2f9a33b7f26de6d,
0c96528e8d43ad4309bdca14b179a5045984655a,
a9fe57fefaac0cb047e4c02e0b8c8f8327e0a58c.

Fixes: QTBUG-132104
Task-number: QTBUG-130290
Change-Id: I1d6703b1fdf6cfd03799fffd33191d8028ecc123
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 8f958a6e2dcff5bb9b01442a19f5605f357c6e7e)
This commit is contained in:
Thiago Macieira 2024-12-11 17:08:30 -03:00
parent 7ab2885594
commit 1596b5855c

View File

@ -450,25 +450,25 @@ inline QDebugIfHasDebugStream<Key, T> operator<<(QDebug debug, const std::multim
} }
template <typename Key, typename Compare, typename Alloc> template <typename Key, typename Compare, typename Alloc>
inline QDebug operator<<(QDebug debug, const std::multiset<Key, Compare, Alloc> &multiset) inline QDebugIfHasDebugStream<Key> operator<<(QDebug debug, const std::multiset<Key, Compare, Alloc> &multiset)
{ {
return QtPrivate::printSequentialContainer(std::move(debug), "std::multiset", multiset); return QtPrivate::printSequentialContainer(std::move(debug), "std::multiset", multiset);
} }
template <typename Key, typename Compare, typename Alloc> template <typename Key, typename Compare, typename Alloc>
inline QDebug operator<<(QDebug debug, const std::set<Key, Compare, Alloc>& set) inline QDebugIfHasDebugStream<Key> operator<<(QDebug debug, const std::set<Key, Compare, Alloc> &set)
{ {
return QtPrivate::printSequentialContainer(std::move(debug), "std::set", set); return QtPrivate::printSequentialContainer(std::move(debug), "std::set", set);
} }
template <typename Key, typename T, typename Hash, typename KeyEqual, typename Alloc> template <typename Key, typename T, typename Hash, typename KeyEqual, typename Alloc>
inline QDebug operator<<(QDebug debug, const std::unordered_map<Key, T, Hash, KeyEqual, Alloc> &unordered_map) inline QDebugIfHasDebugStream<Key, T> operator<<(QDebug debug, const std::unordered_map<Key, T, Hash, KeyEqual, Alloc> &unordered_map)
{ {
return QtPrivate::printSequentialContainer(std::move(debug), "std::unordered_map", unordered_map); // yes, sequential: *it is std::pair return QtPrivate::printSequentialContainer(std::move(debug), "std::unordered_map", unordered_map); // yes, sequential: *it is std::pair
} }
template <typename Key, typename Hash, typename KeyEqual, typename Alloc> template <typename Key, typename Hash, typename KeyEqual, typename Alloc>
inline QDebug operator<<(QDebug debug, const std::unordered_set<Key, Hash, KeyEqual, Alloc>& unordered_set) inline QDebugIfHasDebugStream<Key> operator<<(QDebug debug, const std::unordered_set<Key, Hash, KeyEqual, Alloc> &unordered_set)
{ {
return QtPrivate::printSequentialContainer(std::move(debug), "std::unordered_set", unordered_set); return QtPrivate::printSequentialContainer(std::move(debug), "std::unordered_set", unordered_set);
} }