refs #434 Removed CVariant comparison operator templates.

This commit is contained in:
Mathew Sutcliffe
2015-06-01 18:11:33 +01:00
parent 8db8fdef94
commit e76015004b
2 changed files with 4 additions and 33 deletions

View File

@@ -291,35 +291,6 @@ namespace BlackMisc
uint getValueHash() const;
};
//! Compare stored value of CVariant with any CValueObject derived class.
template <class T, class = typename std::enable_if<QMetaTypeId<T>::Defined>::type>
bool operator ==(const T &value, const CVariant &variant)
{
if (variant.canConvert<T>()) { return variant.value<T>() == value; }
return false;
}
//! Compare stored value of CVariant with any CValueObject derived class.
template <class T, class = typename std::enable_if<QMetaTypeId<T>::Defined>::type>
bool operator !=(const T &value, const CVariant &variant)
{
return !(value == variant);
}
//! Compare stored value of CVariant with any CValueObject derived class.
template <class T, class = typename std::enable_if<QMetaTypeId<T>::Defined>::type>
bool operator ==(const CVariant &variant, const T &value)
{
return value == variant;
}
//! Compare stored value of CVariant with any CValueObject derived class.
template <class T, class = typename std::enable_if<QMetaTypeId<T>::Defined>::type>
bool operator !=(const CVariant &variant, const T &value)
{
return !(value == variant);
}
namespace Private
{
//! \private Needed so we can copy forward-declared CVariant.

View File

@@ -64,10 +64,10 @@ namespace BlackMiscTest
QVERIFY2(station1 == station2, "Station should be equal");
QVERIFY2(station1 != station3, "Station should not be equal");
QVERIFY2(station1qv == station1, "Station should be equal (CVariant)");
QVERIFY2(station1 == station1qv, "Station should be equal (CVariant)");
QVERIFY2(station2 == station1qv, "Station should be equal (CVariant)");
QVERIFY2(station3 != station1qv, "Station should be equal (CVariant)");
QVERIFY2(station1qv == CVariant::from(station1), "Station should be equal (CVariant)");
QVERIFY2(CVariant::from(station1) == station1qv, "Station should be equal (CVariant)");
QVERIFY2(CVariant::from(station2) == station1qv, "Station should be equal (CVariant)");
QVERIFY2(CVariant::from(station3) != station1qv, "Station should be equal (CVariant)");
QVERIFY2(compare(station1, station1) == 0, "Station should be equal");
QVERIFY2(compare(station1, station2) == 0, "Station should be equal");