From 35802ba94948463db19308c8ec385243c51d1485 Mon Sep 17 00:00:00 2001 From: frsyuki Date: Sun, 25 Apr 2010 08:00:04 +0900 Subject: cpp: msgpack_object_equal --- cpp/msgpack/object.h | 2 ++ cpp/msgpack/object.hpp | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'cpp/msgpack') diff --git a/cpp/msgpack/object.h b/cpp/msgpack/object.h index 9a014be..bbfac19 100644 --- a/cpp/msgpack/object.h +++ b/cpp/msgpack/object.h @@ -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 } diff --git a/cpp/msgpack/object.hpp b/cpp/msgpack/object.hpp index a72913a..1362818 100644 --- a/cpp/msgpack/object.hpp +++ b/cpp/msgpack/object.hpp @@ -101,7 +101,7 @@ struct object { template 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 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; -- cgit v1.2.1