16 Buffers [buffer]

16.2 Requirements [buffer.reqmts]

16.2.1 Mutable buffer sequence requirements [buffer.reqmts.mutablebuffersequence]

A mutable buffer sequence represents a set of memory regions that may be used to receive the output of an operation, such as the receive operation of a socket.

A type X meets the MutableBufferSequence requirements if it satisfies the requirements of Destructible (C++ 2014 [destructible]) and CopyConstructible (C++ 2014 [copyconstructible]), as well as the additional requirements listed in Table [tab:buffer.reqmts.mutablebuffersequence.requirements].

In Table [tab:buffer.reqmts.mutablebuffersequence.requirements], x denotes a (possibly const) value of type X, and u denotes an identifier.

Table 12 — MutableBufferSequence requirements
expressionreturn typeassertion/note
pre/post-condition
net::buffer_sequence_begin(x)
net::buffer_sequence_end(x)
An iterator type whose reference type is convertible to mutable_buffer, and which satisfies all the requirements for bidirectional iterators (C++ 2014 [bidirectional.iterators]) except that:
  • there is no requirement that operator-> is provided, and

  • there is no requirement that reference be a reference type.

For a dereferenceable iterator, no increment, decrement, or dereference operation, or conversion of the reference type to mutable_buffer, shall exit via an exception.
X u(x); post:
equal(
  net::buffer_sequence_begin(x),
  net::buffer_sequence_end(x),
  net::buffer_sequence_begin(u),
  net::buffer_sequence_end(u),
  [](const mutable_buffer& b1,
     const mutable_buffer& b2)
   {
     return b1.data() == b2.data()
         && b1.size() == b2.size();
   })