]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix VC6 compilation by changing the order of assignment operators in wxAny
authorJaakko Salli <jaakko.salli@dnainternet.net>
Tue, 20 Apr 2010 12:55:34 +0000 (12:55 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Tue, 20 Apr 2010 12:55:34 +0000 (12:55 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64059 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/any.h
tests/any/anytest.cpp

index 8ee3d3c830d3d621e03f1a5ac8059aef8844f859..2e9a9af4e5c524d00256b4e2eba19b396e41a17b 100644 (file)
@@ -765,6 +765,15 @@ public:
     /**
         Assignment operators.
     */
+    template<typename T>
+    wxAny& operator=(const T &value)
+    {
+        m_type->DeleteValue(m_buffer);
+        m_type = wxAnyValueTypeImpl<T>::sm_instance;
+        wxAnyValueTypeImpl<T>::SetValue(value, m_buffer);
+        return *this;
+    }
+
     wxAny& operator=(const wxAny &any)
     {
         if (this != &any)
@@ -772,18 +781,7 @@ public:
         return *this;
     }
 
-#if wxUSE_VARIANT && (!defined(__VISUALC__) || __VISUALC__ >= 1300)
-    //
-    // Adding this operator for VC6 breaks wxAny, and also
-    // some cases of implicit conversion from wxVariant to wxAny.
-    //
-    // e.g. wxAny any = variant;  // should work
-    //
-    //      wxAny any;
-    //      any = 16;
-    //      any = variant;  // probably doesn't work - uses template
-    //                      // assignment, most likely
-    //
+#if wxUSE_VARIANT
     wxAny& operator=(const wxVariant &variant)
     {
         AssignVariant(variant);
@@ -791,15 +789,6 @@ public:
     }
 #endif
 
-    template<typename T>
-    wxAny& operator=(const T &value)
-    {
-        m_type->DeleteValue(m_buffer);
-        m_type = wxAnyValueTypeImpl<T>::sm_instance;
-        wxAnyValueTypeImpl<T>::SetValue(value, m_buffer);
-        return *this;
-    }
-
     wxAny& operator=(const char* value)
         { Assign(wxString(value)); return *this; }
     wxAny& operator=(const wchar_t* value)
index d405b5cf2fbd576083f0456f091c4086aaa61338..e215f489059a5bcc2bb683e9223df15f3937769c 100644 (file)
@@ -482,16 +482,13 @@ void wxAnyTestCase::wxVariantConversions()
     CPPUNIT_ASSERT(variant.GetType() == "ulonglong");
     CPPUNIT_ASSERT(variant.GetLong() == 1000);
 
-    // FIXME-VC6: for VC6, any = variant needs to be any = wxAny(variant).
-    //            Note that 'wxAny any = variant' does work, probably because
-    //            ctor is used in that case instead of assignment operator.
-    any = wxAny(vString);
+    any = vString;
     CPPUNIT_ASSERT(any == "ABC");
     res = any.GetAs(&variant);
     CPPUNIT_ASSERT(res);
     CPPUNIT_ASSERT(variant.GetString() == "ABC");
 
-    any = wxAny(vDouble);
+    any = vDouble;
     double d = wxANY_AS(any, double);
     CPPUNIT_ASSERT_DOUBLES_EQUAL(d, TEST_FLOAT_CONST, FEQ_DELTA);
     res = any.GetAs(&variant);
@@ -500,7 +497,7 @@ void wxAnyTestCase::wxVariantConversions()
                                  TEST_FLOAT_CONST,
                                  FEQ_DELTA);
 
-    any = wxAny(vBool);
+    any = vBool;
     CPPUNIT_ASSERT(wxANY_AS(any, bool) == true);
     res = any.GetAs(&variant);
     CPPUNIT_ASSERT(res);