You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there anyway to control which fields are packed or unpacked on a call by call basis?
Can I do something like this?
struct C
{
int a;
int b;
int c;
MSGPACK_DEFINE_MAP(a, b, c);
};
C c1;
c1.a = 1;
c1.b = 2;
c1.c = 3;
msgpack::sbuffer buff;
msgpack::packer<msgpack::sbuffer> packer(buff);
// only pack fields a and b
std::string fields1[] = { "a", "b" };
packer.pack(c1, fields1);
// only unpack field a
std::string fields2[] = { "a" };
msgpack::object_handle handle = msgpack::unpack(buff.data(), buff.size(), fields2);
msgpack::object obj = handle.get();
C c2;
obj.convert(c2);
The text was updated successfully, but these errors were encountered:
If msgpack::object contains MAP like {"a":1,"b":2}, then you can get only "a":1 using direct access.
But no key serach are provided.
So first, convert to std::map<std::string, int> m and then get m["a"] is easy way.
Is there anyway to control which fields are packed or unpacked on a call by call basis?
Can I do something like this?
The text was updated successfully, but these errors were encountered: