mirror of
https://github.com/pocoproject/poco.git
synced 2025-02-20 22:31:23 +01:00
== operator & tests
This commit is contained in:
parent
4cf5e8ac12
commit
671fd27d12
@ -171,6 +171,23 @@ public:
|
||||
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;
|
||||
/// Returns the type information of the stored content.
|
||||
|
||||
|
@ -1120,6 +1120,13 @@ void DynamicAnyTest::testConversionOperator()
|
||||
any = 123;
|
||||
std::string s = any;//'s(any)' bombs on gcc 3.4.4
|
||||
assert (s == "123");
|
||||
|
||||
any = 321;
|
||||
s = (std::string) any;//must cast to disambiguate char/string
|
||||
assert (s == "321");
|
||||
|
||||
any = "456";
|
||||
assert (any == "456");
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user