Core: operator==(T, Value) is now resolving type compatibility (instead of crashing)

git-svn-id: svn://ultimatepp.org/upp/trunk@4904 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2012-05-03 09:21:21 +00:00
parent 477d74ae6d
commit b5893f18c3
2 changed files with 10 additions and 4 deletions

View file

@ -285,6 +285,12 @@ NAMESPACE_UPP
#endif
#endif
#ifdef flagOLD_VALUE
#ifdef SVO_VALUE
#undef SVO_VALUE
#endif
#endif
#include "OldValue.h"
#include "Value.h"

View file

@ -260,10 +260,10 @@ inline unsigned ValueGetHashValue(const T& x) {
}
#define VALUE_COMPARE_V(T, VT) \
inline bool operator==(const Value& v, T x) { return (VT)v == x; } \
inline bool operator==(T x, const Value& v) { return (VT)v == x; } \
inline bool operator!=(const Value& v, T x) { return (VT)v != x; } \
inline bool operator!=(T x, const Value& v) { return (VT)v != x; } \
inline bool operator==(const Value& v, T x) { return v.Is<VT>() ? (VT)v == x : v == Value(x); } \
inline bool operator==(T x, const Value& v) { return v.Is<VT>() ? (VT)v == x : v == Value(x); } \
inline bool operator!=(const Value& v, T x) { return v.Is<VT>() ? (VT)v != x : v != Value(x); } \
inline bool operator!=(T x, const Value& v) { return v.Is<VT>() ? (VT)v != x : v != Value(x); } \
#define VALUE_COMPARE(T) VALUE_COMPARE_V(T, T)