Removed `ss.str().data()` (the type of ss is std::stringstream).
Introduced variable that is const reference of `ss.str()`.
This commit is contained in:
Takatoshi Kondo
2019-08-29 20:22:10 +09:00
parent 3129326432
commit 70f950ac05
22 changed files with 203 additions and 112 deletions

View File

@@ -83,7 +83,8 @@ int main() {
u.address = "Tokyo";
msgpack::pack(ss, u);
msgpack::object_handle oh = msgpack::unpack(ss.str().data(), ss.str().size());
std::string const& str = ss.str();
msgpack::object_handle oh = msgpack::unpack(str.data(), str.size());
msgpack::object const& obj = oh.get();
std::cout << "Unpacked msgpack object." << std::endl;
std::cout << obj << std::endl;