mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-05-22 05:34:03 +02:00
Let the compiler deduce the type
It also provides a consistent coding style with the rest of C++11 examples.
This commit is contained in:
parent
555cd3ff68
commit
b9d06fe207
@ -25,8 +25,9 @@ void array() {
|
|||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
msgpack::pack(ss, a);
|
msgpack::pack(ss, a);
|
||||||
|
|
||||||
msgpack::object_handle oh = msgpack::unpack(ss.str().data(), ss.str().size());
|
auto const& str = ss.str();
|
||||||
msgpack::object obj = oh.get();
|
auto oh = msgpack::unpack(str.data(), str.size());
|
||||||
|
auto obj = oh.get();
|
||||||
|
|
||||||
std::cout << obj << std::endl;
|
std::cout << obj << std::endl;
|
||||||
assert((obj.as<std::array<int, 5>>()) == a);
|
assert((obj.as<std::array<int, 5>>()) == a);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user