From b9d06fe207afa7c20cc21fb2917b3357c6e0b9f4 Mon Sep 17 00:00:00 2001 From: Murat Kilivan Date: Mon, 14 Sep 2020 09:06:47 +0100 Subject: [PATCH] Let the compiler deduce the type It also provides a consistent coding style with the rest of C++11 examples. --- example/cpp11/container.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/example/cpp11/container.cpp b/example/cpp11/container.cpp index 59806d83..60b5d4b8 100644 --- a/example/cpp11/container.cpp +++ b/example/cpp11/container.cpp @@ -25,8 +25,9 @@ void array() { std::stringstream ss; msgpack::pack(ss, a); - msgpack::object_handle oh = msgpack::unpack(ss.str().data(), ss.str().size()); - msgpack::object obj = oh.get(); + auto const& str = ss.str(); + auto oh = msgpack::unpack(str.data(), str.size()); + auto obj = oh.get(); std::cout << obj << std::endl; assert((obj.as>()) == a);