1  
//
1  
//
2  
// Copyright (c) 2025 Mohammad Nejati
2  
// Copyright (c) 2025 Mohammad Nejati
3  
//
3  
//
4  
// Distributed under the Boost Software License, Version 1.0. (See accompanying
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)
5  
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6  
//
6  
//
7  
// Official repository: https://github.com/cppalliance/http
7  
// Official repository: https://github.com/cppalliance/http
8  
//
8  
//
9  

9  

10  
#ifndef BOOST_HTTP_DETAIL_BUFFER_UTILS_HPP
10  
#ifndef BOOST_HTTP_DETAIL_BUFFER_UTILS_HPP
11  
#define BOOST_HTTP_DETAIL_BUFFER_UTILS_HPP
11  
#define BOOST_HTTP_DETAIL_BUFFER_UTILS_HPP
12  

12  

13  
#include <boost/capy/buffers.hpp>
13  
#include <boost/capy/buffers.hpp>
14  
#include <boost/core/span.hpp>
14  
#include <boost/core/span.hpp>
15  
#include <iterator>
15  
#include <iterator>
16  

16  

17  
namespace boost {
17  
namespace boost {
18  
namespace http {
18  
namespace http {
19  
namespace detail {
19  
namespace detail {
20  

20  

21  
template<typename BufferSequence>
21  
template<typename BufferSequence>
22  
auto
22  
auto
23  
make_span(BufferSequence const& bs) ->
23  
make_span(BufferSequence const& bs) ->
24  
    boost::span<typename std::iterator_traits<decltype(capy::begin(bs))>::value_type const>
24  
    boost::span<typename std::iterator_traits<decltype(capy::begin(bs))>::value_type const>
25  
{
25  
{
26  
    return { &*capy::begin(bs),
26  
    return { &*capy::begin(bs),
27  
        std::size_t(std::distance(capy::begin(bs), capy::end(bs))) };
27  
        std::size_t(std::distance(capy::begin(bs), capy::end(bs))) };
28  
}
28  
}
29  

29  

30  
} // detail
30  
} // detail
31  
} // http
31  
} // http
32  
} // boost
32  
} // boost
33  

33  

34  
#endif
34  
#endif