Line data Source code
1 : //
2 : // Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.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 : // Official repository: https://github.com/cppalliance/buffers
8 : //
9 :
10 : #ifndef BOOST_BUFFERS_IMPL_CONST_BUFFER_SPAN_HPP
11 : #define BOOST_BUFFERS_IMPL_CONST_BUFFER_SPAN_HPP
12 :
13 : namespace boost {
14 : namespace buffers {
15 :
16 : const_buffer_subspan
17 139638 : const_buffer_span::
18 : prefix_impl(
19 : std::size_t n) const noexcept
20 : {
21 279276 : return const_buffer_subspan(
22 139638 : *this).prefix_impl(n);
23 : }
24 :
25 : const_buffer_subspan
26 139638 : const_buffer_span::
27 : suffix_impl(
28 : std::size_t n) const noexcept
29 : {
30 279276 : return const_buffer_subspan(
31 139638 : *this).suffix_impl(n);
32 : }
33 :
34 : //-----------------------------------------------
35 :
36 : // here because circular dependency
37 279278 : const_buffer_subspan::
38 : const_buffer_subspan(
39 279278 : const_buffer_span const& s) noexcept
40 279278 : : p_(s.p_)
41 279278 : , n_(s.n_)
42 558556 : , p1_([&]() -> std::size_t
43 : {
44 279278 : if(n_ > 0)
45 279277 : return p_[n_-1].size();
46 1 : return 0;
47 279278 : }())
48 : {
49 279278 : }
50 :
51 :
52 : } // buffers
53 : } // boost
54 :
55 : #endif
|