File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
barretenberg/cpp/src/barretenberg/serialize Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,21 @@ e.g. unpacking
9090```
9191 msgpack::unpack((const char*)encoded_data, encoded_data_size).get().convert(*value);
9292```
93+
94+ Note that `msgpack::unpack` returns a `msgpack::object_handle` which controls the lifetime
95+ of the `msgpack::object` returned by `msgpack::object_handle::get`, so if you need access
96+ to the object itself, do break up the above to keep a reference to the handle, for example:
97+
98+ ```
99+ msgpack::object_handle oh = msgpack::unpack((const char*)encoded_data, encoded_data_size);
100+ msgpack::object o = oh.get();
101+ try {
102+ o.convert(*value);
103+ } catch (const msgpack::type_error&) {
104+ std::cerr << "failed to unpack: " << o << std::endl;
105+ throw;
106+ }
107+ ```
93108*/
94109#include " msgpack_impl/concepts.hpp"
95110#include " msgpack_impl/name_value_pair_macro.hpp"
You can’t perform that action at this time.
0 commit comments