diff --git a/Foundation/include/Poco/Dynamic/Var.h b/Foundation/include/Poco/Dynamic/Var.h index 83d1e1971..77b52939c 100644 --- a/Foundation/include/Poco/Dynamic/Var.h +++ b/Foundation/include/Poco/Dynamic/Var.h @@ -190,11 +190,6 @@ public: } } - operator const std::string & (); - /// Specialization of the cast operator for const std::string reference. - /// The main reason for this specialization is to help compilers - /// with construction/assignment of Var to std::string. - template const T& extract() const /// Returns a const reference to the actual value. diff --git a/Foundation/src/Var.cpp b/Foundation/src/Var.cpp index 78debccec..e9457946d 100644 --- a/Foundation/src/Var.cpp +++ b/Foundation/src/Var.cpp @@ -69,15 +69,6 @@ Var::~Var() } -Var::operator const std::string & () -{ - if (typeid(std::string) != _pHolder->type()) - *this = this->convert(); - - return extract(); -} - - Var& Var::operator = (const Var& other) { Var tmp(other); diff --git a/Foundation/testsuite/src/VarTest.cpp b/Foundation/testsuite/src/VarTest.cpp index 5b89bc312..398db810f 100644 --- a/Foundation/testsuite/src/VarTest.cpp +++ b/Foundation/testsuite/src/VarTest.cpp @@ -1406,18 +1406,14 @@ void VarTest::testConversionOperator() assert (any == i); any = 123; -#ifdef _MSC_VER - std::string s1(any); -#else // gcc won't compile above (ambiguous cctor call) - std::string s1 = any; -#endif + std::string s1 = any.convert(); assert (s1 == "123"); assert (s1 == any); assert (any == s1); assert ("123" == any); any = 321; - s1 =any.convert(); + s1 = any.convert(); assert (s1 == "321"); any = "456"; @@ -1425,7 +1421,7 @@ void VarTest::testConversionOperator() assert ("456" == any); any = 789; - std::string s2 = any; + std::string s2 = any.convert(); assert (s2 == "789"); assert (s2 == any); assert (any == s2);