diff options
| author | frsyuki <frsyuki@users.sourceforge.jp> | 2010-04-25 01:24:24 +0900 |
|---|---|---|
| committer | frsyuki <frsyuki@users.sourceforge.jp> | 2010-04-25 01:24:24 +0900 |
| commit | 01b6673528127538457fdf445531f3574dc0c20a (patch) | |
| tree | c264c52c2d3f554e60767f78f161c2bf6d5a9b5d /cpp/msgpack/object.hpp | |
| parent | 4e85ebbf9863201107a8f5c68fdabc92749e04fc (diff) | |
| download | msgpack-python-01b6673528127538457fdf445531f3574dc0c20a.tar.gz | |
cpp: bool operator==(object& x, const T& y)
Diffstat (limited to 'cpp/msgpack/object.hpp')
| -rw-r--r-- | cpp/msgpack/object.hpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/cpp/msgpack/object.hpp b/cpp/msgpack/object.hpp index a094c56..df1079b 100644 --- a/cpp/msgpack/object.hpp +++ b/cpp/msgpack/object.hpp @@ -128,6 +128,9 @@ private: bool operator==(const object x, const object y); bool operator!=(const object x, const object y); +template <typename T> +bool operator==(const object x, const T& y); + std::ostream& operator<< (std::ostream& s, const object o); @@ -207,6 +210,14 @@ inline packer<Stream>& operator<< (packer<Stream>& o, const T& v) inline bool operator!=(const object x, const object y) { return !(x == y); } +template <typename T> +inline bool operator==(const object x, const T& y) +try { + return x == object(y); +} catch (msgpack::type_error&) { + return false; +} + inline object::implicit_type object::convert() const { |
