#include <iostream>
#include <boost/asio/streambuf.hpp>
#include <boost/asio/buffer.hpp>
int main()
{
/* Convert std::string to boost::asio::streambuf */
boost::asio::streambuf sbuf;
std::iostream os(&sbuf);
std::string message("Teststring");
os << message;
/* Convert boost::asio::streambuf to std::string */
std::string str((std::istreambuf_iterator<char>(&sbuf)), std::istreambuf_iterator<char>());
std::cout << str << std::endl;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Ym9vc3QvYXNpby9zdHJlYW1idWYuaHBwPgojaW5jbHVkZSA8Ym9vc3QvYXNpby9idWZmZXIuaHBwPgoKaW50IG1haW4oKQp7CiAgIC8qIENvbnZlcnQgc3RkOjpzdHJpbmcgdG8gYm9vc3Q6OmFzaW86OnN0cmVhbWJ1ZiAqLwogICBib29zdDo6YXNpbzo6c3RyZWFtYnVmIHNidWY7CiAgIHN0ZDo6aW9zdHJlYW0gb3MoJnNidWYpOwogICBzdGQ6OnN0cmluZyBtZXNzYWdlKCJUZXN0c3RyaW5nIik7CiAgIG9zIDw8IG1lc3NhZ2U7CgogICAvKiBDb252ZXJ0IGJvb3N0Ojphc2lvOjpzdHJlYW1idWYgdG8gc3RkOjpzdHJpbmcgKi8KICAgc3RkOjpzdHJpbmcgc3RyKChzdGQ6OmlzdHJlYW1idWZfaXRlcmF0b3I8Y2hhcj4oJnNidWYpKSwgc3RkOjppc3RyZWFtYnVmX2l0ZXJhdG9yPGNoYXI+KCkpOwogICAKICAgc3RkOjpjb3V0IDw8IHN0ciA8PCBzdGQ6OmVuZGw7Cn0K