]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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_BUFFER_CAT_HPP | |
9 | #define BEAST_BUFFER_CAT_HPP | |
10 | ||
11 | #include <beast/config.hpp> | |
12 | #include <beast/core/detail/buffer_cat.hpp> | |
13 | #include <boost/asio/buffer.hpp> | |
14 | #include <cstdint> | |
15 | #include <iterator> | |
16 | #include <new> | |
17 | #include <stdexcept> | |
18 | #include <tuple> | |
19 | #include <utility> | |
20 | ||
21 | namespace beast { | |
22 | ||
23 | /** Concatenate 2 or more buffer sequences. | |
24 | ||
25 | This function returns a constant or mutable buffer sequence which, | |
26 | when iterated, efficiently concatenates the input buffer sequences. | |
27 | Copies of the arguments passed will be made; however, the returned | |
28 | object does not take ownership of the underlying memory. The | |
29 | application is still responsible for managing the lifetime of the | |
30 | referenced memory. | |
31 | ||
32 | @param buffers The list of buffer sequences to concatenate. | |
33 | ||
34 | @return A new buffer sequence that represents the concatenation of | |
35 | the input buffer sequences. This buffer sequence will be a | |
36 | @b MutableBufferSequence if each of the passed buffer sequences is | |
37 | also a @b MutableBufferSequence, else the returned buffer sequence | |
38 | will be a @b ConstBufferSequence. | |
39 | */ | |
40 | #if BEAST_DOXYGEN | |
41 | template<class... BufferSequence> | |
42 | implementation_defined | |
43 | buffer_cat(BufferSequence const&... buffers) | |
44 | #else | |
45 | template<class B1, class B2, class... Bn> | |
46 | detail::buffer_cat_helper<B1, B2, Bn...> | |
47 | buffer_cat(B1 const& b1, B2 const& b2, Bn const&... bn) | |
48 | #endif | |
49 | { | |
50 | static_assert( | |
51 | detail::is_all_ConstBufferSequence<B1, B2, Bn...>::value, | |
52 | "BufferSequence requirements not met"); | |
53 | return detail::buffer_cat_helper< | |
54 | B1, B2, Bn...>{b1, b2, bn...}; | |
55 | } | |
56 | ||
57 | } // beast | |
58 | ||
59 | #endif |