cpp: msgpack_object_equal

This commit is contained in:
frsyuki 2010-04-25 08:00:04 +09:00
parent 72160aac9a
commit 35802ba949
5 changed files with 78 additions and 59 deletions

View file

@ -79,6 +79,8 @@ typedef struct msgpack_object_kv {
void msgpack_object_print(FILE* out, msgpack_object o);
bool msgpack_object_equal(const msgpack_object x, const msgpack_object y);
#ifdef __cplusplus
}

View file

@ -101,7 +101,7 @@ struct object {
template <typename T>
object& operator=(const T& v);
operator msgpack_object();
operator msgpack_object() const;
struct with_zone;
@ -226,6 +226,11 @@ void operator<< (object::with_zone& o, const T& v)
}
inline bool operator==(const object x, const object y)
{
return msgpack_object_equal(x, y);
}
template <typename T>
inline bool operator==(const object x, const T& y)
try {
@ -310,7 +315,7 @@ inline void operator<< (object& o, msgpack_object v)
::memcpy(&o, &v, sizeof(v));
}
inline object::operator msgpack_object()
inline object::operator msgpack_object() const
{
// FIXME beter way?
msgpack_object obj;