mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-04-27 10:26:01 +02:00
Added STR to std::string conversion.
This commit is contained in:
parent
59d994ea5f
commit
c08439ff41
@ -26,8 +26,17 @@ namespace msgpack {
|
||||
|
||||
inline std::string& operator>> (object const& o, std::string& v)
|
||||
{
|
||||
if(o.type != type::BIN) { throw type_error(); }
|
||||
switch (o.type) {
|
||||
case type::BIN:
|
||||
v.assign(o.via.bin.ptr, o.via.bin.size);
|
||||
break;
|
||||
case type::STR:
|
||||
v.assign(o.via.str.ptr, o.via.str.size);
|
||||
break;
|
||||
default:
|
||||
throw type_error();
|
||||
break;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user