Skip to content

Instantly share code, notes, and snippets.

@unnonouno
Created March 17, 2014 16:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unnonouno/9603213 to your computer and use it in GitHub Desktop.
Save unnonouno/9603213 to your computer and use it in GitHub Desktop.
msgpack test
#include <map>
#include <iostream>
#include <msgpack.hpp>
int main() {
std::map<int, int> m;
msgpack::sbuffer sbuf;
msgpack::packer<msgpack::sbuffer> pk(&sbuf);
pk.pack(m);
m[1] = 10;
msgpack::unpacked msg;
msgpack::unpack(&msg, sbuf.data(), sbuf.size());
msgpack::object obj = msg.get();
obj.convert(&m);
std::cout << m.size() << std::endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment