16 Buffers [buffer]

16.2 Requirements [buffer.reqmts]

16.2.2 Constant buffer sequence requirements [buffer.reqmts.constbuffersequence]

A constant buffer sequence represents a set of memory regions that may be used as input to an operation, such as the send operation of a socket.

A type X meets the ConstBufferSequence 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.constbuffersequence.requirements].

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

Table 13 — ConstBufferSequence 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 const_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 const_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 const_buffer& b1,
     const const_buffer& b2)
   {
     return b1.data() == b2.data()
         && b1.size() == b2.size();
   })