mirror of
https://github.com/msgpack/msgpack-python.git
synced 2026-02-07 02:09:59 +00:00
lang/c/msgpack: C++ binding: reexamined global operators
git-svn-id: file:///Users/frsyuki/project/msgpack-git/svn/x@72 5a5092ae-2292-43ba-b2d5-dcab9c1a2731
This commit is contained in:
parent
f4a6d7faa1
commit
2c7f0b2b1a
10 changed files with 241 additions and 209 deletions
|
|
@ -21,26 +21,28 @@
|
|||
#include "msgpack/object.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
namespace type {
|
||||
|
||||
namespace type {
|
||||
|
||||
struct nil { };
|
||||
|
||||
inline nil& operator<< (nil& v, object o)
|
||||
} // namespace type
|
||||
|
||||
|
||||
inline type::nil& operator>> (object o, type::nil& v)
|
||||
{
|
||||
if(o.type != NIL) { throw type_error(); }
|
||||
if(o.type != type::NIL) { throw type_error(); }
|
||||
return v;
|
||||
}
|
||||
|
||||
template <typename Stream>
|
||||
inline const nil& operator>> (const nil& v, packer<Stream>& o)
|
||||
inline packer<Stream>& operator<< (packer<Stream>& o, const type::nil& v)
|
||||
{
|
||||
o.pack_nil();
|
||||
return v;
|
||||
return o;
|
||||
}
|
||||
|
||||
|
||||
} // namespace type
|
||||
} // namespace msgpack
|
||||
|
||||
#endif /* msgpack/type/nil.hpp */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue