I'm trying to store a std::map<enum, int>
in a boost::beast::multi_buffer
. So far I've been using boost::asio::buffer_copy
and boost::asio::buffer
to store vectors and PODs. However, I couldn't find a way to store a STL map.
I've tried this:
auto t_map = std::map<CODES, int>(); // CODES is an enum type
auto t_map_size = t_map.size() * sizeof(std::pair<CODES, int>);
auto tmp_buffer = boost::asio::buffer(t_map, t_map_size); // this is not supported
auto size = boost::asio::buffer_copy(t_map_size , tmp_buffer);
boost::beast::multi_buffer buffer;
buffer.commit(size);
- Is there any way to store a
std::map<enum, int>
in aConstBufferSequence
? (because theboost::asio::buffer_copy
needs one) - If not, is there any workaround to store a
std::map<enum, int>
in aboost::beast::multi_buffer
?
Thanks!