Go to file
Christopher Kohlhoff 66095aa1f2 Add new DynamicBuffer_v2 which is CopyConstructible.
This change adds a new set of type requirements for dynamic buffers,
DynamicBuffer_v2, which supports copy construction. These new type
requirements enable dynamic buffers to be used as arguments to
user-defined composed operations, where the same dynamic buffer object
is used repeatedly for multiple underlying operations. For example:

  template <typename DynamicBuffer>
  void echo_line(tcp::socket& sock, DynamicBuffer buf)
  {
    n = asio::read_until(sock, buf, '\n');
    asio::write(sock, buf, asio::transfer_exactly(n));
  }

The original DynamicBuffer type requirements have been renamed to
DynamicBuffer_v1.

New type traits is_dynamic_buffer_v1 and is_dynamic_buffer_v2 have been
added to test for conformance to DynamicBuffer_v1 and DynamicBuffer_v2
respectively. The existing is_dynamic_buffer trait has been retained and
delegates to is_dynamic_buffer_v1, unless ASIO_NO_DYNAMIC_BUFFER_V1 is
defined, in which case it delegates to is_dynamic_buffer_v2.

The dynamic_string_buffer and dynamic_vector buffer classes conform to
both DynamicBuffer_v1 and DynamicBuffer_v2 requirements.

When ASIO_NO_DYNAMIC_BUFFER_V1 is defined, all support for
DynamicBuffer_v1 types and functions is #ifdef-ed out. Support for using
basic_streambuf with the read, async_read, read_until, async_read_until,
write, and async_write functions is also disabled as a consequence.

This change should have no impact on existing source code that simply
uses dynamic buffers in conjunction with asio's composed operations,
such as:

  string data;
  // ...
  size_t n = asio::read_until(my_socket
      asio::dynamic_buffer(data, MY_MAX),
      '\n');
2019-03-03 19:40:27 +11:00
asio Add new DynamicBuffer_v2 which is CopyConstructible. 2019-03-03 19:40:27 +11:00
.appveyor.yml Add travis and appveyor configuration. 2017-07-15 13:33:23 +10:00
.gitignore Ignore scratch source files and symlinked boost. 2014-04-28 12:51:01 +10:00
.travis.yml Add travis and appveyor configuration. 2017-07-15 13:33:23 +10:00