mirror of
https://github.com/msgpack/msgpack-python.git
synced 2026-02-07 02:09:59 +00:00
cpp: bool operator==(object& x, const T& y)
This commit is contained in:
parent
4e85ebbf98
commit
01b6673528
3 changed files with 21 additions and 0 deletions
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue