mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-10-14 06:55:50 +02: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:
@@ -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 */
|
||||
|
Reference in New Issue
Block a user