msgpack::object elem;
std::string tempString = "string";
elem["type"] = msgpack::pack(tempString);
Above code doesn't work
error: no matching function for call to 'pack(std::string&)'
How can I pack string into msgpack::object?
msgpack::object elem;
std::string tempString = "string";
elem["type"] = msgpack::pack(tempString);
Above code doesn't work
error: no matching function for call to 'pack(std::string&)'
How can I pack string into msgpack::object?
Copyright © 2021 Jogjafile Inc.
msgpack::pack()is a free function template in the namespacemsgpack:The function obviously is stateless and needs a target where to pack the
tempStringto. The target can be any class that has the member funcitonwrite(const char*, std::size_t);. For example, usestd::stringstream:And you might want this: