Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

buffer_size

Get the total number of bytes in a buffer sequence.

template<
    typename BufferSequence>
std::size_t buffer_size(
    const BufferSequence & b);

The buffer_size function determines the total size of all buffers in the buffer sequence, as if computed as follows:

size_t total_size = 0;
auto i = boost::asio::buffer_sequence_begin(buffers);
auto end = boost::asio::buffer_sequence_end(buffers);
for (; i != end; ++i)
{
  const_buffer b(*i);
  total_size += b.size();
}
return total_size;

The BufferSequence template parameter may meet either of the ConstBufferSequence or MutableBufferSequence type requirements.

Requirements

Header: boost/asio/buffer.hpp

Convenience header: boost/asio.hpp


PrevUpHomeNext