New ostream() returns dynamic buffer output stream (API Change):

This eliminates beast::write output for dynamic buffers and replaces
it with the function ostream() that wraps a caller provided dynamic
buffer and returns the result as a std::ostream derived object.
Callers may now produce formatted output into any object meeting the
requirements of DynamicBuffer using operator<< and the standard stream
modifiers such as std::endl.

This new technique is more efficient, as implementations of operator<<
can now write directly into the output using std::ostream::write and
std::ostream::put.

Example of use:

  beast::streambuf sb;
  beast::ostream(sb) << "Hello, world!" << std::endl;
This commit is contained in:
Vinnie Falco
2017-07-20 08:12:16 -07:00
parent 3f58d81fc4
commit 3add5f293c
16 changed files with 373 additions and 337 deletions
-8
View File
@@ -273,13 +273,6 @@ public:
BEAST_EXPECT(test::buffer_count(sb.data()) == 4);
}
void testOutputStream()
{
streambuf sb;
sb << "x";
BEAST_EXPECT(to_string(sb.data()) == "x");
}
void testCapacity()
{
using boost::asio::buffer_size;
@@ -353,7 +346,6 @@ public:
testConsume();
testMatrix();
testIterators();
testOutputStream();
testCapacity();
}
};