Skip to content

Instantly share code, notes, and snippets.

@vladon
Last active May 27, 2023 06:45
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vladon/8b487e41cb3b49e172db to your computer and use it in GitHub Desktop.
Save vladon/8b487e41cb3b49e172db to your computer and use it in GitHub Desktop.
Returns `boost::asio::streambuf` contents represented as `std::string`
std::string buffer_to_string(const boost::asio::streambuf &buffer)
{
using boost::asio::buffers_begin;
auto bufs = buffer.data();
std::string result(buffers_begin(bufs), buffers_begin(bufs) + buffer.size());
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment