]> git.proxmox.com Git - ceph.git/blob - ceph/src/Beast/include/beast/core/prepare_buffers.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / Beast / include / beast / core / prepare_buffers.hpp
1 //
2 // Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 //
7
8 #ifndef BEAST_PREPARE_BUFFERS_HPP
9 #define BEAST_PREPARE_BUFFERS_HPP
10
11 #include <beast/config.hpp>
12 #include <beast/core/detail/prepare_buffers.hpp>
13 #include <boost/asio/buffer.hpp>
14 #include <algorithm>
15 #include <cstdint>
16 #include <iterator>
17 #include <stdexcept>
18 #include <type_traits>
19 #include <utility>
20
21 namespace beast {
22
23 /** Return a shortened buffer sequence.
24
25 This function returns a new buffer sequence which adapts the
26 passed buffer sequence and efficiently presents a shorter subset
27 of the original list of buffers starting with the first byte of
28 the original sequence.
29
30 @param n The maximum number of bytes in the wrapped
31 sequence. If this is larger than the size of passed,
32 buffers, the resulting sequence will represent the
33 entire input sequence.
34
35 @param buffers The buffer sequence to adapt. A copy of
36 the sequence will be made, but ownership of the underlying
37 memory is not transferred.
38 */
39 template<class BufferSequence>
40 #if BEAST_DOXYGEN
41 implementation_defined
42 #else
43 inline
44 detail::prepared_buffers<BufferSequence>
45 #endif
46 prepare_buffers(std::size_t n, BufferSequence const& buffers)
47 {
48 return detail::prepared_buffers<BufferSequence>(n, buffers);
49 }
50
51 } // beast
52
53 #endif