From e76015004b51de750e901616f1cb05c42c66e50e Mon Sep 17 00:00:00 2001 From: Mathew Sutcliffe Date: Mon, 1 Jun 2015 18:11:33 +0100 Subject: [PATCH] refs #434 Removed CVariant comparison operator templates. --- src/blackmisc/variant.h | 29 --------------------------- tests/blackmisc/testvariantandmap.cpp | 8 ++++---- 2 files changed, 4 insertions(+), 33 deletions(-) diff --git a/src/blackmisc/variant.h b/src/blackmisc/variant.h index e284544ec..559356065 100644 --- a/src/blackmisc/variant.h +++ b/src/blackmisc/variant.h @@ -291,35 +291,6 @@ namespace BlackMisc uint getValueHash() const; }; - //! Compare stored value of CVariant with any CValueObject derived class. - template ::Defined>::type> - bool operator ==(const T &value, const CVariant &variant) - { - if (variant.canConvert()) { return variant.value() == value; } - return false; - } - - //! Compare stored value of CVariant with any CValueObject derived class. - template ::Defined>::type> - bool operator !=(const T &value, const CVariant &variant) - { - return !(value == variant); - } - - //! Compare stored value of CVariant with any CValueObject derived class. - template ::Defined>::type> - bool operator ==(const CVariant &variant, const T &value) - { - return value == variant; - } - - //! Compare stored value of CVariant with any CValueObject derived class. - template ::Defined>::type> - bool operator !=(const CVariant &variant, const T &value) - { - return !(value == variant); - } - namespace Private { //! \private Needed so we can copy forward-declared CVariant. diff --git a/tests/blackmisc/testvariantandmap.cpp b/tests/blackmisc/testvariantandmap.cpp index f582ee0f8..c91dfd449 100644 --- a/tests/blackmisc/testvariantandmap.cpp +++ b/tests/blackmisc/testvariantandmap.cpp @@ -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");