2 // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
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)
7 // Official repository: https://github.com/boostorg/beast
10 #ifndef BOOST_BEAST_DETAIL_BUFFERS_RANGE_ADAPTOR_HPP
11 #define BOOST_BEAST_DETAIL_BUFFERS_RANGE_ADAPTOR_HPP
13 #include <boost/beast/core/buffer_traits.hpp>
15 #include <type_traits>
21 template<class BufferSequence>
22 class buffers_range_adaptor
27 #if BOOST_BEAST_DOXYGEN
28 using value_type = __see_below__;
30 using value_type = buffers_type<BufferSequence>;
35 friend class buffers_range_adaptor;
38 buffers_iterator_type<BufferSequence>;
42 const_iterator(iter_type const& it)
48 using value_type = typename
49 buffers_range_adaptor::value_type;
50 using pointer = value_type const*;
51 using reference = value_type;
52 using difference_type = std::ptrdiff_t;
53 using iterator_category =
54 std::bidirectional_iterator_tag;
56 const_iterator() = default;
59 operator==(const_iterator const& other) const
61 return it_ == other.it_;
65 operator!=(const_iterator const& other) const
67 return !(*this == other);
77 operator->() const = delete;
111 buffers_range_adaptor(BufferSequence const& b)
117 begin() const noexcept
119 return {net::buffer_sequence_begin(b_)};
125 return {net::buffer_sequence_end(b_)};