mirror of
https://github.com/pocoproject/poco.git
synced 2025-11-24 14:20:10 +01:00
== operator & tests
This commit is contained in:
@@ -171,6 +171,23 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool operator == (const T& other)
|
||||||
|
/// Equality operator
|
||||||
|
{
|
||||||
|
T result;
|
||||||
|
_pHolder->convert(result);
|
||||||
|
return result == other;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator == (const char* other)
|
||||||
|
/// Equality operator
|
||||||
|
{
|
||||||
|
std::string result;
|
||||||
|
_pHolder->convert(result);
|
||||||
|
return result == other;
|
||||||
|
}
|
||||||
|
|
||||||
const std::type_info& type() const;
|
const std::type_info& type() const;
|
||||||
/// Returns the type information of the stored content.
|
/// Returns the type information of the stored content.
|
||||||
|
|
||||||
|
|||||||
@@ -1120,6 +1120,13 @@ void DynamicAnyTest::testConversionOperator()
|
|||||||
any = 123;
|
any = 123;
|
||||||
std::string s = any;//'s(any)' bombs on gcc 3.4.4
|
std::string s = any;//'s(any)' bombs on gcc 3.4.4
|
||||||
assert (s == "123");
|
assert (s == "123");
|
||||||
|
|
||||||
|
any = 321;
|
||||||
|
s = (std::string) any;//must cast to disambiguate char/string
|
||||||
|
assert (s == "321");
|
||||||
|
|
||||||
|
any = "456";
|
||||||
|
assert (any == "456");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user