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
Pick-to: 6.9
Change-Id: I1d6703b1fdf6cfd03799fffd33191d8028ecc123
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
This commit is contained in:
Thiago Macieira 2024-12-11 17:08:30 -03:00
parent efd0b6de12
commit 8f958a6e2d

View File

@ -453,25 +453,25 @@ inline QDebugIfHasDebugStream<Key, T> operator<<(QDebug debug, const std::multim
}
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);
}
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);
}
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
}
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);
}