Files
boost_beast/include/beast/core/prepare_buffers.hpp
T

52 lines
1.4 KiB
C++
Raw Normal View History

2016-04-19 20:29:16 -04:00
//
2017-02-06 20:07:03 -05:00
// Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
2016-04-19 20:29:16 -04:00
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
2016-04-01 11:46:32 -04:00
2016-04-19 20:29:16 -04:00
#ifndef BEAST_PREPARE_BUFFERS_HPP
#define BEAST_PREPARE_BUFFERS_HPP
2016-04-01 11:46:32 -04:00
2016-11-08 17:41:20 -05:00
#include <beast/core/detail/prepare_buffers.hpp>
2016-04-01 11:46:32 -04:00
#include <boost/asio/buffer.hpp>
#include <algorithm>
#include <cstdint>
#include <iterator>
#include <stdexcept>
2016-11-08 17:23:31 -05:00
#include <type_traits>
2016-04-01 11:46:32 -04:00
#include <utility>
namespace beast {
2016-11-08 17:23:31 -05:00
/** Return a shortened buffer sequence.
2016-04-01 11:46:32 -04:00
2016-11-08 17:23:31 -05:00
This function returns a new buffer sequence which adapts the
passed buffer sequence and efficiently presents a shorter subset
of the original list of buffers starting with the first byte of
the original sequence.
2016-04-01 11:46:32 -04:00
2016-11-08 17:23:31 -05:00
@param n The maximum number of bytes in the wrapped
sequence. If this is larger than the size of passed,
buffers, the resulting sequence will represent the
entire input sequence.
2016-04-01 11:46:32 -04:00
2016-11-08 17:23:31 -05:00
@param buffers The buffer sequence to adapt. A copy of
the sequence will be made, but ownership of the underlying
memory is not transferred.
2016-04-01 11:46:32 -04:00
*/
template<class BufferSequence>
2016-11-08 17:41:20 -05:00
#if GENERATING_DOCS
implementation_defined
#else
inline
detail::prepared_buffers<BufferSequence>
#endif
prepare_buffers(std::size_t n, BufferSequence const& buffers)
{
return detail::prepared_buffers<BufferSequence>(n, buffers);
}
2016-04-01 11:46:32 -04:00
} // beast
#endif