summaryrefslogtreecommitdiff
path: root/cpp/msgpack
diff options
context:
space:
mode:
authorfrsyuki <frsyuki@users.sourceforge.jp>2010-04-25 08:00:04 +0900
committerfrsyuki <frsyuki@users.sourceforge.jp>2010-04-25 08:00:04 +0900
commit35802ba94948463db19308c8ec385243c51d1485 (patch)
treedbb198a2fdd1735fa189b9c635664055602fe4fe /cpp/msgpack
parent72160aac9a1536234700539eacc9bdc7bf6f9f61 (diff)
downloadmsgpack-python-35802ba94948463db19308c8ec385243c51d1485.tar.gz
cpp: msgpack_object_equal
Diffstat (limited to 'cpp/msgpack')
-rw-r--r--cpp/msgpack/object.h2
-rw-r--r--cpp/msgpack/object.hpp9
2 files changed, 9 insertions, 2 deletions
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 <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;