10 #ifndef BOOST_BEAST_BUFFER_PREFIX_HPP 11 #define BOOST_BEAST_BUFFER_PREFIX_HPP 16 #include <boost/asio/buffer.hpp> 18 #include <type_traits> 31 template<
class BufferSequence>
34 using buffers_type =
typename 35 std::decay<BufferSequence>::type;
38 typename buffers_type::const_iterator;
44 template<
class Deduced>
46 Deduced&& other, std::size_t dist)
47 : bs_(std::forward<Deduced>(other).bs_)
49 , end_(std::next(bs_.begin(), dist))
54 setup(std::size_t size);
59 std::is_convertible<
typename 60 std::iterator_traits<iter_type>::value_type,
61 boost::asio::mutable_buffer>::value,
62 boost::asio::mutable_buffer,
63 boost::asio::const_buffer>::type;
65 #if BOOST_BEAST_DOXYGEN 110 template<
class... Args>
113 boost::in_place_init_t,
140 boost::asio::const_buffer
142 boost::asio::const_buffer buffer)
144 using boost::asio::buffer_cast;
145 using boost::asio::buffer_size;
146 return { buffer_cast<
void const*>(buffer),
147 (std::min)(size, buffer_size(buffer)) };
165 boost::asio::mutable_buffer
167 boost::asio::mutable_buffer buffer)
169 using boost::asio::buffer_cast;
170 using boost::asio::buffer_size;
171 return {buffer_cast<
void*>(buffer),
172 (std::min)(size, buffer_size(buffer))};
191 template<
class BufferSequence>
192 #if BOOST_BEAST_DOXYGEN 196 typename std::enable_if<
197 ! std::is_same<BufferSequence,
198 boost::asio::const_buffer>::value &&
199 ! std::is_same<BufferSequence,
200 boost::asio::mutable_buffer>::value,
208 "BufferSequence requirements not met");
222 template<
class BufferSequence>
223 typename std::conditional<
225 boost::asio::mutable_buffer,
226 boost::asio::const_buffer>::type
229 auto const first = buffers.begin();
230 if(first == buffers.end())
buffer_prefix_view & operator=(buffer_prefix_view &&)
Move assignment.
Definition: buffer_prefix.ipp:189
const_iterator end() const
Get a bidirectional iterator to one past the last element.
Definition: buffer_prefix.ipp:245
typename std::conditional< std::is_convertible< typename std::iterator_traits< iter_type >::value_type, boost::asio::mutable_buffer >::value, boost::asio::mutable_buffer, boost::asio::const_buffer >::type value_type
The type for each element in the list of buffers.
Definition: buffer_prefix.hpp:63
Definition: buffer_prefix.ipp:50
Definition: async_result.hpp:20
detail::buffers_helper< ConstBufferSequence > buffers(ConstBufferSequence const &b)
Definition: ostream.hpp:50
Definition: buffer_prefix.hpp:32
Definition: type_traits.hpp:59
std::conditional< is_mutable_buffer_sequence< BufferSequence >::value, boost::asio::mutable_buffer, boost::asio::const_buffer >::type buffer_front(BufferSequence const &buffers)
Definition: buffer_prefix.hpp:227
const_iterator begin() const
Get a bidirectional iterator to the first element.
Definition: buffer_prefix.ipp:236
Definition: type_traits.hpp:96
boost::asio::const_buffer buffer_prefix(std::size_t size, boost::asio::const_buffer buffer)
Definition: buffer_prefix.hpp:141