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

@@ -25,7 +25,8 @@ TEST(MSGPACK_BOOST, pack_convert_string_view)
msgpack::pack(ss, val1);
msgpack::object_handle oh;
msgpack::unpack(oh, ss.str().data(), ss.str().size());
std::string const& str = ss.str();
msgpack::unpack(oh, str.data(), str.size());
boost::string_view val2 = oh.get().as<boost::string_view>();
EXPECT_TRUE(val1 == val2);
}