Only declare comparison operators for QVector when comparable
This avoid SFINAE from incorrectly assuming QVectors of non-comparable types has them. Change-Id: Ie44eb7873384a0f41a6b8160c340b71ea25839dd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
5ebb03c476
commit
bbe71efc23
@ -738,31 +738,35 @@ uint qHash(const QVector<T> &key, uint seed = 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
bool operator<(const QVector<T> &lhs, const QVector<T> &rhs)
|
auto operator<(const QVector<T> &lhs, const QVector<T> &rhs)
|
||||||
noexcept(noexcept(std::lexicographical_compare(lhs.begin(), lhs.end(),
|
noexcept(noexcept(std::lexicographical_compare(lhs.begin(), lhs.end(),
|
||||||
rhs.begin(), rhs.end())))
|
rhs.begin(), rhs.end())))
|
||||||
|
-> decltype(std::declval<T>() < std::declval<T>())
|
||||||
{
|
{
|
||||||
return std::lexicographical_compare(lhs.begin(), lhs.end(),
|
return std::lexicographical_compare(lhs.begin(), lhs.end(),
|
||||||
rhs.begin(), rhs.end());
|
rhs.begin(), rhs.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline bool operator>(const QVector<T> &lhs, const QVector<T> &rhs)
|
auto operator>(const QVector<T> &lhs, const QVector<T> &rhs)
|
||||||
noexcept(noexcept(lhs < rhs))
|
noexcept(noexcept(lhs < rhs))
|
||||||
|
-> decltype(lhs < rhs)
|
||||||
{
|
{
|
||||||
return rhs < lhs;
|
return rhs < lhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline bool operator<=(const QVector<T> &lhs, const QVector<T> &rhs)
|
auto operator<=(const QVector<T> &lhs, const QVector<T> &rhs)
|
||||||
noexcept(noexcept(lhs < rhs))
|
noexcept(noexcept(lhs < rhs))
|
||||||
|
-> decltype(lhs < rhs)
|
||||||
{
|
{
|
||||||
return !(lhs > rhs);
|
return !(lhs > rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline bool operator>=(const QVector<T> &lhs, const QVector<T> &rhs)
|
auto operator>=(const QVector<T> &lhs, const QVector<T> &rhs)
|
||||||
noexcept(noexcept(lhs < rhs))
|
noexcept(noexcept(lhs < rhs))
|
||||||
|
-> decltype(lhs < rhs)
|
||||||
{
|
{
|
||||||
return !(lhs < rhs);
|
return !(lhs < rhs);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user