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

@@ -82,10 +82,11 @@ int main() {
std::stringstream ss;
msgpack::pack(ss, my);
print(ss.str());
std::string const& str = ss.str();
print(str);
msgpack::object_handle oh =
msgpack::unpack(ss.str().data(), ss.str().size());
msgpack::unpack(str.data(), str.size());
msgpack::object obj = oh.get();
std::cout << obj << std::endl;
assert(obj.as<my_class>() == my);