From what I could assemble, this is a move-only type in which the actual msgpack::object data is msgpack::object . This is very good, perhaps intended to detail the implementation, but sometimes it sometimes flows into the user code. For example, at any time when you want to capture msgpack::object in lambda, you should also capture msgpack::zone object. Sometimes you cannot use move capture (for example, asio handlers in some cases will only accept handlers with the ability to copy, or your compiler does not support this function). To get around this, you can:
msgpack::unpacked r; while (pac_.next(&r)) { auto msg = result.get(); io_->post([this, msg, z = std::shared_ptr<msgpack::zone>(r.zone().release())]() { // msg is valid here })); }
source share