include/boost/capy/buffers/buffer_array.hpp
97.4% Lines (454/466)
100.0% List of functions (75/75)
76.5% Branches (176/230)
Functions (75)
Function
Calls
Lines
Branches
Blocks
boost::capy::buffer_array<2ul, false>::buffer_array()
:102
1x
100.0%
–
100.0%
boost::capy::buffer_array<2ul, true>::buffer_array()
:102
1x
100.0%
–
100.0%
boost::capy::buffer_array<4ul, false>::buffer_array()
:102
2x
100.0%
–
100.0%
boost::capy::buffer_array<4ul, true>::buffer_array()
:102
2x
100.0%
–
100.0%
boost::capy::buffer_array<16ul, false>::buffer_array(boost::capy::buffer_array<16ul, false> const&)
:109
141x
100.0%
100.0%
100.0%
boost::capy::buffer_array<16ul, true>::buffer_array(boost::capy::buffer_array<16ul, true> const&)
:109
117x
100.0%
100.0%
100.0%
boost::capy::buffer_array<4ul, false>::buffer_array(boost::capy::buffer_array<4ul, false> const&)
:109
2193x
100.0%
100.0%
100.0%
boost::capy::buffer_array<4ul, true>::buffer_array(boost::capy::buffer_array<4ul, true> const&)
:109
2193x
100.0%
100.0%
100.0%
boost::capy::buffer_array<16ul, false>::buffer_array(boost::capy::mutable_buffer const&)
:121
69x
100.0%
100.0%
100.0%
boost::capy::buffer_array<16ul, true>::buffer_array(boost::capy::const_buffer const&)
:121
50x
100.0%
100.0%
100.0%
boost::capy::buffer_array<4ul, false>::buffer_array(boost::capy::mutable_buffer const&)
:121
5x
100.0%
50.0%
100.0%
boost::capy::buffer_array<4ul, true>::buffer_array(boost::capy::const_buffer const&)
:121
6x
100.0%
100.0%
100.0%
boost::capy::buffer_array<16ul, false>::buffer_array<std::array<boost::capy::mutable_buffer, 2ul> >(std::array<boost::capy::mutable_buffer, 2ul> const&)
:145
12x
100.0%
66.7%
100.0%
boost::capy::buffer_array<16ul, false>::buffer_array<std::span<boost::capy::mutable_buffer const, 18446744073709551615ul> >(std::span<boost::capy::mutable_buffer const, 18446744073709551615ul> const&)
:145
6x
100.0%
75.0%
100.0%
boost::capy::buffer_array<16ul, false>::buffer_array<std::span<boost::capy::mutable_buffer, 18446744073709551615ul> >(std::span<boost::capy::mutable_buffer, 18446744073709551615ul> const&)
:145
52x
100.0%
75.0%
100.0%
boost::capy::buffer_array<16ul, false>::buffer_array<std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >(std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > const&)
:145
6x
100.0%
75.0%
100.0%
boost::capy::buffer_array<16ul, true>::buffer_array<std::array<boost::capy::const_buffer, 2ul> >(std::array<boost::capy::const_buffer, 2ul> const&)
:145
6x
100.0%
66.7%
100.0%
boost::capy::buffer_array<16ul, true>::buffer_array<std::span<boost::capy::const_buffer const, 18446744073709551615ul> >(std::span<boost::capy::const_buffer const, 18446744073709551615ul> const&)
:145
8x
100.0%
75.0%
100.0%
boost::capy::buffer_array<16ul, true>::buffer_array<std::span<boost::capy::const_buffer, 18446744073709551615ul> >(std::span<boost::capy::const_buffer, 18446744073709551615ul> const&)
:145
51x
100.0%
87.5%
100.0%
boost::capy::buffer_array<16ul, true>::buffer_array<std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >(std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > const&)
:145
6x
100.0%
75.0%
100.0%
boost::capy::buffer_array<2ul, false>::buffer_array<std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >(std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > const&)
:145
2x
100.0%
75.0%
100.0%
boost::capy::buffer_array<2ul, true>::buffer_array<std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >(std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > const&)
:145
2x
100.0%
75.0%
100.0%
boost::capy::buffer_array<4ul, false>::buffer_array<std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >(std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > const&)
:145
17x
100.0%
87.5%
100.0%
boost::capy::buffer_array<4ul, true>::buffer_array<std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >(std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > const&)
:145
17x
100.0%
87.5%
100.0%
boost::capy::buffer_array<2ul, false>::buffer_array<std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >(std::in_place_t, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > const&)
:174
1x
92.3%
66.7%
94.0%
boost::capy::buffer_array<2ul, true>::buffer_array<std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >(std::in_place_t, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > const&)
:174
1x
92.3%
66.7%
94.0%
boost::capy::buffer_array<4ul, false>::buffer_array<std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >(std::in_place_t, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > const&)
:174
1x
92.3%
66.7%
89.0%
boost::capy::buffer_array<4ul, true>::buffer_array<std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >(std::in_place_t, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > const&)
:174
1x
92.3%
66.7%
89.0%
boost::capy::buffer_array<2ul, false>::buffer_array<__gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > > >(__gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >, __gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >)
:203
1x
100.0%
75.0%
100.0%
boost::capy::buffer_array<2ul, true>::buffer_array<__gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > > >(__gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >, __gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >)
:203
1x
100.0%
75.0%
100.0%
boost::capy::buffer_array<4ul, false>::buffer_array<__gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > > >(__gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >, __gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >)
:203
3x
100.0%
87.5%
100.0%
boost::capy::buffer_array<4ul, true>::buffer_array<__gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > > >(__gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >, __gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >)
:203
3x
100.0%
87.5%
100.0%
boost::capy::buffer_array<2ul, false>::buffer_array<__gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > > >(std::in_place_t, __gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >, __gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >)
:230
1x
90.9%
66.7%
93.0%
boost::capy::buffer_array<2ul, true>::buffer_array<__gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > > >(std::in_place_t, __gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >, __gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >)
:230
1x
90.9%
66.7%
93.0%
boost::capy::buffer_array<4ul, false>::buffer_array<__gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > > >(std::in_place_t, __gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >, __gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >)
:230
1x
90.9%
66.7%
93.0%
boost::capy::buffer_array<4ul, true>::buffer_array<__gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > > >(std::in_place_t, __gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >, __gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >)
:230
1x
90.9%
66.7%
93.0%
boost::capy::buffer_array<16ul, false>::~buffer_array()
:249
286x
100.0%
100.0%
100.0%
boost::capy::buffer_array<16ul, true>::~buffer_array()
:249
238x
100.0%
100.0%
100.0%
boost::capy::buffer_array<2ul, false>::~buffer_array()
:249
4x
100.0%
100.0%
100.0%
boost::capy::buffer_array<2ul, true>::~buffer_array()
:249
4x
100.0%
100.0%
100.0%
boost::capy::buffer_array<4ul, false>::~buffer_array()
:249
2222x
100.0%
100.0%
100.0%
boost::capy::buffer_array<4ul, true>::~buffer_array()
:249
2223x
100.0%
100.0%
100.0%
boost::capy::buffer_array<2ul, false>::operator=(boost::capy::buffer_array<2ul, false> const&)
:258
1x
88.9%
66.7%
90.0%
boost::capy::buffer_array<2ul, true>::operator=(boost::capy::buffer_array<2ul, true> const&)
:258
1x
88.9%
66.7%
90.0%
boost::capy::buffer_array<4ul, false>::operator=(boost::capy::buffer_array<4ul, false> const&)
:258
1x
88.9%
66.7%
90.0%
boost::capy::buffer_array<4ul, true>::operator=(boost::capy::buffer_array<4ul, true> const&)
:258
1x
88.9%
66.7%
90.0%
boost::capy::buffer_array<4ul, false>::begin()
:275
4416x
100.0%
–
100.0%
boost::capy::buffer_array<4ul, true>::begin()
:275
4418x
100.0%
–
100.0%
boost::capy::buffer_array<4ul, false>::begin() const
:283
5511x
100.0%
–
100.0%
boost::capy::buffer_array<4ul, true>::begin() const
:283
5511x
100.0%
–
100.0%
boost::capy::buffer_array<4ul, false>::end()
:291
4416x
100.0%
–
100.0%
boost::capy::buffer_array<4ul, true>::end()
:291
4417x
100.0%
–
100.0%
boost::capy::buffer_array<4ul, false>::end() const
:299
5511x
100.0%
–
100.0%
boost::capy::buffer_array<4ul, true>::end() const
:299
5511x
100.0%
–
100.0%
boost::capy::buffer_array<16ul, false>::to_span()
:307
195x
100.0%
–
100.0%
boost::capy::buffer_array<16ul, true>::to_span()
:307
155x
100.0%
–
100.0%
boost::capy::buffer_array<2ul, false>::to_span()
:307
3x
100.0%
–
100.0%
boost::capy::buffer_array<2ul, true>::to_span()
:307
3x
100.0%
–
100.0%
boost::capy::buffer_array<4ul, false>::to_span()
:307
11x
100.0%
–
100.0%
boost::capy::buffer_array<4ul, true>::to_span()
:307
12x
100.0%
–
100.0%
boost::capy::buffer_array<16ul, false>::to_span() const
:315
54x
100.0%
–
100.0%
boost::capy::buffer_array<16ul, true>::to_span() const
:315
121x
100.0%
–
100.0%
boost::capy::buffer_array<4ul, false>::operator std::span<boost::capy::mutable_buffer, 18446744073709551615ul>()
:322
1x
100.0%
–
100.0%
boost::capy::tag_invoke(boost::capy::size_tag const&, boost::capy::buffer_array<2ul, false> const&)
:338
3x
100.0%
–
100.0%
boost::capy::tag_invoke(boost::capy::size_tag const&, boost::capy::buffer_array<2ul, true> const&)
:338
3x
100.0%
–
100.0%
boost::capy::tag_invoke(boost::capy::size_tag const&, boost::capy::buffer_array<4ul, false> const&)
:338
2746x
100.0%
–
100.0%
boost::capy::tag_invoke(boost::capy::size_tag const&, boost::capy::buffer_array<4ul, true> const&)
:338
2747x
100.0%
–
100.0%
boost::capy::tag_invoke(boost::capy::slice_tag const&, boost::capy::buffer_array<4ul, false>&, boost::capy::slice_how, unsigned long)
:349
1040x
100.0%
–
100.0%
boost::capy::tag_invoke(boost::capy::slice_tag const&, boost::capy::buffer_array<4ul, true>&, boost::capy::slice_how, unsigned long)
:349
1040x
100.0%
–
100.0%
boost::capy::buffer_array<4ul, false>::slice_impl(boost::capy::slice_how, unsigned long)
:360
1040x
100.0%
66.7%
100.0%
boost::capy::buffer_array<4ul, true>::slice_impl(boost::capy::slice_how, unsigned long)
:360
1040x
100.0%
66.7%
100.0%
boost::capy::buffer_array<4ul, false>::remove_prefix_impl(unsigned long)
:377
512x
100.0%
–
100.0%
boost::capy::buffer_array<4ul, true>::remove_prefix_impl(unsigned long)
:377
512x
100.0%
–
100.0%
boost::capy::buffer_array<4ul, false>::keep_prefix_impl(unsigned long)
:383
528x
100.0%
–
100.0%
boost::capy::buffer_array<4ul, true>::keep_prefix_impl(unsigned long)
:383
528x
100.0%
–
100.0%
| Line | Branch | TLA | Hits | Source Code |
|---|---|---|---|---|
| 1 | // | |||
| 2 | // Copyright (c) 2025 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/capy | |||
| 8 | // | |||
| 9 | ||||
| 10 | #ifndef BOOST_CAPY_BUFFERS_BUFFER_ARRAY_HPP | |||
| 11 | #define BOOST_CAPY_BUFFERS_BUFFER_ARRAY_HPP | |||
| 12 | ||||
| 13 | #include <boost/capy/detail/config.hpp> | |||
| 14 | #include <boost/capy/detail/except.hpp> | |||
| 15 | #include <boost/capy/buffers.hpp> | |||
| 16 | ||||
| 17 | #include <cstddef> | |||
| 18 | #include <new> | |||
| 19 | #include <span> | |||
| 20 | #include <utility> | |||
| 21 | ||||
| 22 | namespace boost { | |||
| 23 | namespace capy { | |||
| 24 | ||||
| 25 | namespace detail { | |||
| 26 | ||||
| 27 | BOOST_CAPY_DECL | |||
| 28 | void | |||
| 29 | buffer_array_remove_prefix( | |||
| 30 | const_buffer* arr, | |||
| 31 | std::size_t* count, | |||
| 32 | std::size_t* total_size, | |||
| 33 | std::size_t n) noexcept; | |||
| 34 | ||||
| 35 | BOOST_CAPY_DECL | |||
| 36 | void | |||
| 37 | buffer_array_remove_prefix( | |||
| 38 | mutable_buffer* arr, | |||
| 39 | std::size_t* count, | |||
| 40 | std::size_t* total_size, | |||
| 41 | std::size_t n) noexcept; | |||
| 42 | ||||
| 43 | BOOST_CAPY_DECL | |||
| 44 | void | |||
| 45 | buffer_array_keep_prefix( | |||
| 46 | const_buffer* arr, | |||
| 47 | std::size_t* count, | |||
| 48 | std::size_t* total_size, | |||
| 49 | std::size_t n) noexcept; | |||
| 50 | ||||
| 51 | BOOST_CAPY_DECL | |||
| 52 | void | |||
| 53 | buffer_array_keep_prefix( | |||
| 54 | mutable_buffer* arr, | |||
| 55 | std::size_t* count, | |||
| 56 | std::size_t* total_size, | |||
| 57 | std::size_t n) noexcept; | |||
| 58 | ||||
| 59 | } // namespace detail | |||
| 60 | ||||
| 61 | /** A buffer sequence holding up to N buffers. | |||
| 62 | ||||
| 63 | This class template stores a fixed-capacity array of buffer | |||
| 64 | descriptors, where the actual count can vary from 0 to N. | |||
| 65 | It provides efficient storage for small buffer sequences | |||
| 66 | without dynamic allocation. | |||
| 67 | ||||
| 68 | @tparam N Maximum number of buffers the array can hold. | |||
| 69 | @tparam IsConst If true, holds const_buffer; otherwise mutable_buffer. | |||
| 70 | ||||
| 71 | @par Usage | |||
| 72 | ||||
| 73 | @code | |||
| 74 | void process(ConstBufferSequence auto const& buffers) | |||
| 75 | { | |||
| 76 | const_buffer_array<4> bufs(buffers); | |||
| 77 | // use bufs.begin(), bufs.end(), bufs.to_span() | |||
| 78 | } | |||
| 79 | @endcode | |||
| 80 | */ | |||
| 81 | template<std::size_t N, bool IsConst> | |||
| 82 | class buffer_array | |||
| 83 | { | |||
| 84 | public: | |||
| 85 | /** The type of buffer stored in the array. | |||
| 86 | */ | |||
| 87 | using value_type = std::conditional_t<IsConst, const_buffer, mutable_buffer>; | |||
| 88 | ||||
| 89 | private: | |||
| 90 | std::size_t n_ = 0; | |||
| 91 | std::size_t size_ = 0; | |||
| 92 | union { | |||
| 93 | int dummy_; | |||
| 94 | value_type arr_[N]; | |||
| 95 | }; | |||
| 96 | ||||
| 97 | public: | |||
| 98 | /** Default constructor. | |||
| 99 | ||||
| 100 | Constructs an empty buffer array. | |||
| 101 | */ | |||
| 102 | 6x | buffer_array() noexcept | ||
| 103 | 6x | : dummy_(0) | ||
| 104 | { | |||
| 105 | 6x | } | ||
| 106 | ||||
| 107 | /** Copy constructor. | |||
| 108 | */ | |||
| 109 | 4644x | buffer_array(buffer_array const& other) noexcept | ||
| 110 | 4644x | : n_(other.n_) | ||
| 111 | 4644x | , size_(other.size_) | ||
| 112 | { | |||
| 113 |
8/8boost::capy::buffer_array<16ul, false>::buffer_array(boost::capy::buffer_array<16ul, false> const&):
✓ Branch 0 taken 244 times.
✓ Branch 1 taken 141 times.
boost::capy::buffer_array<16ul, true>::buffer_array(boost::capy::buffer_array<16ul, true> const&):
✓ Branch 0 taken 213 times.
✓ Branch 1 taken 117 times.
boost::capy::buffer_array<4ul, false>::buffer_array(boost::capy::buffer_array<4ul, false> const&):
✓ Branch 0 taken 3511 times.
✓ Branch 1 taken 2193 times.
boost::capy::buffer_array<4ul, true>::buffer_array(boost::capy::buffer_array<4ul, true> const&):
✓ Branch 0 taken 3511 times.
✓ Branch 1 taken 2193 times.
|
12123x | for(std::size_t i = 0; i < n_; ++i) | |
| 114 | 7479x | ::new(&arr_[i]) value_type(other.arr_[i]); | ||
| 115 | 4644x | } | ||
| 116 | ||||
| 117 | /** Construct from a single buffer. | |||
| 118 | ||||
| 119 | @param b The buffer to store. | |||
| 120 | */ | |||
| 121 | 130x | buffer_array(value_type const& b) noexcept | ||
| 122 | 130x | : dummy_(0) | ||
| 123 | { | |||
| 124 |
7/8boost::capy::buffer_array<16ul, false>::buffer_array(boost::capy::mutable_buffer const&):
✓ Branch 1 taken 64 times.
✓ Branch 2 taken 5 times.
boost::capy::buffer_array<16ul, true>::buffer_array(boost::capy::const_buffer const&):
✓ Branch 1 taken 48 times.
✓ Branch 2 taken 2 times.
boost::capy::buffer_array<4ul, false>::buffer_array(boost::capy::mutable_buffer const&):
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
boost::capy::buffer_array<4ul, true>::buffer_array(boost::capy::const_buffer const&):
✓ Branch 1 taken 5 times.
✓ Branch 2 taken 1 time.
|
130x | if(b.size() != 0) | |
| 125 | { | |||
| 126 | 122x | ::new(&arr_[0]) value_type(b); | ||
| 127 | 122x | n_ = 1; | ||
| 128 | 122x | size_ = b.size(); | ||
| 129 | } | |||
| 130 | 130x | } | ||
| 131 | ||||
| 132 | /** Construct from a buffer sequence. | |||
| 133 | ||||
| 134 | Copies up to N buffer descriptors from the source | |||
| 135 | sequence into the internal array. If the sequence | |||
| 136 | contains more than N non-empty buffers, excess | |||
| 137 | buffers are silently ignored. | |||
| 138 | ||||
| 139 | @param bs The buffer sequence to copy from. | |||
| 140 | */ | |||
| 141 | template<class BS> | |||
| 142 | requires (IsConst ? ConstBufferSequence<BS> : MutableBufferSequence<BS>) | |||
| 143 | && (!std::same_as<std::remove_cvref_t<BS>, buffer_array>) | |||
| 144 | && (!std::same_as<std::remove_cvref_t<BS>, value_type>) | |||
| 145 | 185x | buffer_array(BS const& bs) noexcept | ||
| 146 | 185x | : dummy_(0) | ||
| 147 | { | |||
| 148 | 185x | auto it = capy::begin(bs); | ||
| 149 | 185x | auto const last = capy::end(bs); | ||
| 150 |
56/68boost::capy::buffer_array<16ul, false>::buffer_array<std::array<boost::capy::mutable_buffer, 2ul> >(std::array<boost::capy::mutable_buffer, 2ul> const&):
✓ Branch 0 taken 24 times.
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
boost::capy::buffer_array<16ul, false>::buffer_array<std::span<boost::capy::mutable_buffer const, 18446744073709551615ul> >(std::span<boost::capy::mutable_buffer const, 18446744073709551615ul> const&):
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 12 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 12 times.
✓ Branch 6 taken 6 times.
boost::capy::buffer_array<16ul, false>::buffer_array<std::span<boost::capy::mutable_buffer, 18446744073709551615ul> >(std::span<boost::capy::mutable_buffer, 18446744073709551615ul> const&):
✓ Branch 1 taken 52 times.
✓ Branch 2 taken 52 times.
✓ Branch 3 taken 52 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 52 times.
✓ Branch 6 taken 52 times.
boost::capy::buffer_array<16ul, false>::buffer_array<std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >(std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > const&):
✓ Branch 1 taken 102 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 96 times.
✓ Branch 4 taken 6 times.
✓ Branch 5 taken 96 times.
✓ Branch 6 taken 6 times.
boost::capy::buffer_array<16ul, true>::buffer_array<std::array<boost::capy::const_buffer, 2ul> >(std::array<boost::capy::const_buffer, 2ul> const&):
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 12 times.
✗ Branch 3 not taken.
boost::capy::buffer_array<16ul, true>::buffer_array<std::span<boost::capy::const_buffer const, 18446744073709551615ul> >(std::span<boost::capy::const_buffer const, 18446744073709551615ul> const&):
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 8 times.
✓ Branch 3 taken 12 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 12 times.
✓ Branch 6 taken 8 times.
boost::capy::buffer_array<16ul, true>::buffer_array<std::span<boost::capy::const_buffer, 18446744073709551615ul> >(std::span<boost::capy::const_buffer, 18446744073709551615ul> const&):
✓ Branch 1 taken 51 times.
✓ Branch 2 taken 51 times.
✓ Branch 3 taken 51 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 51 times.
✓ Branch 6 taken 51 times.
boost::capy::buffer_array<16ul, true>::buffer_array<std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >(std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > const&):
✓ Branch 1 taken 102 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 96 times.
✓ Branch 4 taken 6 times.
✓ Branch 5 taken 96 times.
✓ Branch 6 taken 6 times.
boost::capy::buffer_array<2ul, false>::buffer_array<std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >(std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > const&):
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 4 times.
✓ Branch 6 taken 2 times.
boost::capy::buffer_array<2ul, true>::buffer_array<std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >(std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > const&):
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 4 times.
✓ Branch 6 taken 2 times.
boost::capy::buffer_array<4ul, false>::buffer_array<std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >(std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > const&):
✓ Branch 1 taken 35 times.
✓ Branch 2 taken 17 times.
✓ Branch 3 taken 35 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 35 times.
✓ Branch 6 taken 17 times.
boost::capy::buffer_array<4ul, true>::buffer_array<std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >(std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > const&):
✓ Branch 1 taken 35 times.
✓ Branch 2 taken 17 times.
✓ Branch 3 taken 35 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 35 times.
✓ Branch 6 taken 17 times.
|
618x | while(it != last && n_ < N) | |
| 151 | { | |||
| 152 | 433x | value_type b(*it); | ||
| 153 |
15/24boost::capy::buffer_array<16ul, false>::buffer_array<std::array<boost::capy::mutable_buffer, 2ul> >(std::array<boost::capy::mutable_buffer, 2ul> const&):
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
boost::capy::buffer_array<16ul, false>::buffer_array<std::span<boost::capy::mutable_buffer const, 18446744073709551615ul> >(std::span<boost::capy::mutable_buffer const, 18446744073709551615ul> const&):
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
boost::capy::buffer_array<16ul, false>::buffer_array<std::span<boost::capy::mutable_buffer, 18446744073709551615ul> >(std::span<boost::capy::mutable_buffer, 18446744073709551615ul> const&):
✓ Branch 1 taken 52 times.
✗ Branch 2 not taken.
boost::capy::buffer_array<16ul, false>::buffer_array<std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >(std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > const&):
✓ Branch 1 taken 96 times.
✗ Branch 2 not taken.
boost::capy::buffer_array<16ul, true>::buffer_array<std::array<boost::capy::const_buffer, 2ul> >(std::array<boost::capy::const_buffer, 2ul> const&):
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
boost::capy::buffer_array<16ul, true>::buffer_array<std::span<boost::capy::const_buffer const, 18446744073709551615ul> >(std::span<boost::capy::const_buffer const, 18446744073709551615ul> const&):
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
boost::capy::buffer_array<16ul, true>::buffer_array<std::span<boost::capy::const_buffer, 18446744073709551615ul> >(std::span<boost::capy::const_buffer, 18446744073709551615ul> const&):
✓ Branch 1 taken 49 times.
✓ Branch 2 taken 2 times.
boost::capy::buffer_array<16ul, true>::buffer_array<std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >(std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > const&):
✓ Branch 1 taken 96 times.
✗ Branch 2 not taken.
boost::capy::buffer_array<2ul, false>::buffer_array<std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >(std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > const&):
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
boost::capy::buffer_array<2ul, true>::buffer_array<std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >(std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > const&):
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
boost::capy::buffer_array<4ul, false>::buffer_array<std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >(std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > const&):
✓ Branch 1 taken 33 times.
✓ Branch 2 taken 2 times.
boost::capy::buffer_array<4ul, true>::buffer_array<std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >(std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > const&):
✓ Branch 1 taken 33 times.
✓ Branch 2 taken 2 times.
|
433x | if(b.size() != 0) | |
| 154 | { | |||
| 155 | 427x | ::new(&arr_[n_++]) value_type(b); | ||
| 156 | 427x | size_ += b.size(); | ||
| 157 | } | |||
| 158 | 433x | ++it; | ||
| 159 | } | |||
| 160 | 185x | } | ||
| 161 | ||||
| 162 | /** Construct from a buffer sequence with overflow checking. | |||
| 163 | ||||
| 164 | Copies buffer descriptors from the source sequence | |||
| 165 | into the internal array. | |||
| 166 | ||||
| 167 | @param bs The buffer sequence to copy from. | |||
| 168 | ||||
| 169 | @throws std::length_error if the sequence contains | |||
| 170 | more than N non-empty buffers. | |||
| 171 | */ | |||
| 172 | template<class BS> | |||
| 173 | requires (IsConst ? ConstBufferSequence<BS> : MutableBufferSequence<BS>) | |||
| 174 | 4x | buffer_array(std::in_place_t, BS const& bs) | ||
| 175 | 4x | : dummy_(0) | ||
| 176 | { | |||
| 177 | 4x | auto it = capy::begin(bs); | ||
| 178 | 4x | auto const last = capy::end(bs); | ||
| 179 |
6/8boost::capy::buffer_array<2ul, false>::buffer_array<std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >(std::in_place_t, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > const&):
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
boost::capy::buffer_array<2ul, true>::buffer_array<std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >(std::in_place_t, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > const&):
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
boost::capy::buffer_array<4ul, false>::buffer_array<std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >(std::in_place_t, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > const&):
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 1 time.
boost::capy::buffer_array<4ul, true>::buffer_array<std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >(std::in_place_t, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > const&):
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 1 time.
|
14x | while(it != last) | |
| 180 | { | |||
| 181 | 12x | value_type b(*it); | ||
| 182 |
4/8boost::capy::buffer_array<2ul, false>::buffer_array<std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >(std::in_place_t, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > const&):
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
boost::capy::buffer_array<2ul, true>::buffer_array<std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >(std::in_place_t, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > const&):
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
boost::capy::buffer_array<4ul, false>::buffer_array<std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >(std::in_place_t, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > const&):
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
boost::capy::buffer_array<4ul, true>::buffer_array<std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >(std::in_place_t, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > const&):
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
|
12x | if(b.size() != 0) | |
| 183 | { | |||
| 184 |
6/8boost::capy::buffer_array<2ul, false>::buffer_array<std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >(std::in_place_t, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > const&):
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 2 times.
boost::capy::buffer_array<2ul, true>::buffer_array<std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >(std::in_place_t, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > const&):
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 2 times.
boost::capy::buffer_array<4ul, false>::buffer_array<std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >(std::in_place_t, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > const&):
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
boost::capy::buffer_array<4ul, true>::buffer_array<std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >(std::in_place_t, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > const&):
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
12x | if(n_ >= N) | |
| 185 | 2x | detail::throw_length_error(); | ||
| 186 | 10x | ::new(&arr_[n_++]) value_type(b); | ||
| 187 | 10x | size_ += b.size(); | ||
| 188 | } | |||
| 189 | 10x | ++it; | ||
| 190 | } | |||
| 191 | 2x | } | ||
| 192 | ||||
| 193 | /** Construct from an iterator range. | |||
| 194 | ||||
| 195 | Copies up to N non-empty buffer descriptors from the | |||
| 196 | range `[first, last)`. If the range contains more than | |||
| 197 | N non-empty buffers, excess buffers are silently ignored. | |||
| 198 | ||||
| 199 | @param first Iterator to the first buffer descriptor. | |||
| 200 | @param last Iterator past the last buffer descriptor. | |||
| 201 | */ | |||
| 202 | template<class Iterator> | |||
| 203 | 8x | buffer_array(Iterator first, Iterator last) noexcept | ||
| 204 | 8x | : dummy_(0) | ||
| 205 | { | |||
| 206 |
20/24boost::capy::buffer_array<2ul, false>::buffer_array<__gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > > >(__gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >, __gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >):
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 1 time.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 1 time.
boost::capy::buffer_array<2ul, true>::buffer_array<__gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > > >(__gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >, __gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >):
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 1 time.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 1 time.
boost::capy::buffer_array<4ul, false>::buffer_array<__gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > > >(__gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >, __gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >):
✓ Branch 1 taken 7 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 7 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 7 times.
✓ Branch 6 taken 3 times.
boost::capy::buffer_array<4ul, true>::buffer_array<__gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > > >(__gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >, __gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >):
✓ Branch 1 taken 7 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 7 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 7 times.
✓ Branch 6 taken 3 times.
|
26x | while(first != last && n_ < N) | |
| 207 | { | |||
| 208 | 18x | value_type b(*first); | ||
| 209 |
6/8boost::capy::buffer_array<2ul, false>::buffer_array<__gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > > >(__gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >, __gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >):
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
boost::capy::buffer_array<2ul, true>::buffer_array<__gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > > >(__gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >, __gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >):
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
boost::capy::buffer_array<4ul, false>::buffer_array<__gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > > >(__gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >, __gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >):
✓ Branch 1 taken 5 times.
✓ Branch 2 taken 2 times.
boost::capy::buffer_array<4ul, true>::buffer_array<__gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > > >(__gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >, __gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >):
✓ Branch 1 taken 5 times.
✓ Branch 2 taken 2 times.
|
18x | if(b.size() != 0) | |
| 210 | { | |||
| 211 | 14x | ::new(&arr_[n_++]) value_type(b); | ||
| 212 | 14x | size_ += b.size(); | ||
| 213 | } | |||
| 214 | 18x | ++first; | ||
| 215 | } | |||
| 216 | 8x | } | ||
| 217 | ||||
| 218 | /** Construct from an iterator range with overflow checking. | |||
| 219 | ||||
| 220 | Copies all non-empty buffer descriptors from the range | |||
| 221 | `[first, last)` into the internal array. | |||
| 222 | ||||
| 223 | @param first Iterator to the first buffer descriptor. | |||
| 224 | @param last Iterator past the last buffer descriptor. | |||
| 225 | ||||
| 226 | @throws std::length_error if the range contains more | |||
| 227 | than N non-empty buffers. | |||
| 228 | */ | |||
| 229 | template<class Iterator> | |||
| 230 | 4x | buffer_array(std::in_place_t, Iterator first, Iterator last) | ||
| 231 | 4x | : dummy_(0) | ||
| 232 | { | |||
| 233 |
6/8boost::capy::buffer_array<2ul, false>::buffer_array<__gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > > >(std::in_place_t, __gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >, __gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >):
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
boost::capy::buffer_array<2ul, true>::buffer_array<__gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > > >(std::in_place_t, __gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >, __gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >):
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
boost::capy::buffer_array<4ul, false>::buffer_array<__gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > > >(std::in_place_t, __gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >, __gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >):
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 1 time.
boost::capy::buffer_array<4ul, true>::buffer_array<__gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > > >(std::in_place_t, __gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >, __gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >):
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 1 time.
|
14x | while(first != last) | |
| 234 | { | |||
| 235 | 12x | value_type b(*first); | ||
| 236 |
4/8boost::capy::buffer_array<2ul, false>::buffer_array<__gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > > >(std::in_place_t, __gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >, __gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >):
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
boost::capy::buffer_array<2ul, true>::buffer_array<__gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > > >(std::in_place_t, __gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >, __gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >):
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
boost::capy::buffer_array<4ul, false>::buffer_array<__gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > > >(std::in_place_t, __gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >, __gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >):
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
boost::capy::buffer_array<4ul, true>::buffer_array<__gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > > >(std::in_place_t, __gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >, __gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >):
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
|
12x | if(b.size() != 0) | |
| 237 | { | |||
| 238 |
6/8boost::capy::buffer_array<2ul, false>::buffer_array<__gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > > >(std::in_place_t, __gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >, __gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >):
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 2 times.
boost::capy::buffer_array<2ul, true>::buffer_array<__gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > > >(std::in_place_t, __gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >, __gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >):
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 2 times.
boost::capy::buffer_array<4ul, false>::buffer_array<__gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > > >(std::in_place_t, __gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >, __gnu_cxx::__normal_iterator<boost::capy::mutable_buffer*, std::vector<boost::capy::mutable_buffer, std::allocator<boost::capy::mutable_buffer> > >):
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
boost::capy::buffer_array<4ul, true>::buffer_array<__gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > > >(std::in_place_t, __gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >, __gnu_cxx::__normal_iterator<boost::capy::const_buffer*, std::vector<boost::capy::const_buffer, std::allocator<boost::capy::const_buffer> > >):
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
12x | if(n_ >= N) | |
| 239 | 2x | detail::throw_length_error(); | ||
| 240 | 10x | ::new(&arr_[n_++]) value_type(b); | ||
| 241 | 10x | size_ += b.size(); | ||
| 242 | } | |||
| 243 | 10x | ++first; | ||
| 244 | } | |||
| 245 | 2x | } | ||
| 246 | ||||
| 247 | /** Destructor. | |||
| 248 | */ | |||
| 249 | 4977x | ~buffer_array() | ||
| 250 | { | |||
| 251 |
12/12boost::capy::buffer_array<16ul, false>::~buffer_array():
✓ Branch 0 taken 492 times.
✓ Branch 1 taken 286 times.
boost::capy::buffer_array<16ul, true>::~buffer_array():
✓ Branch 0 taken 430 times.
✓ Branch 1 taken 238 times.
boost::capy::buffer_array<2ul, false>::~buffer_array():
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 4 times.
boost::capy::buffer_array<2ul, true>::~buffer_array():
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 4 times.
boost::capy::buffer_array<4ul, false>::~buffer_array():
✓ Branch 0 taken 2961 times.
✓ Branch 1 taken 2222 times.
boost::capy::buffer_array<4ul, true>::~buffer_array():
✓ Branch 0 taken 2961 times.
✓ Branch 1 taken 2223 times.
|
11837x | while(n_--) | |
| 252 | 6860x | arr_[n_].~value_type(); | ||
| 253 | 4977x | } | ||
| 254 | ||||
| 255 | /** Copy assignment. | |||
| 256 | */ | |||
| 257 | buffer_array& | |||
| 258 | 4x | operator=(buffer_array const& other) noexcept | ||
| 259 | { | |||
| 260 |
4/8boost::capy::buffer_array<2ul, false>::operator=(boost::capy::buffer_array<2ul, false> const&):
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
boost::capy::buffer_array<2ul, true>::operator=(boost::capy::buffer_array<2ul, true> const&):
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
boost::capy::buffer_array<4ul, false>::operator=(boost::capy::buffer_array<4ul, false> const&):
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
boost::capy::buffer_array<4ul, true>::operator=(boost::capy::buffer_array<4ul, true> const&):
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
4x | if(this != &other) | |
| 261 | { | |||
| 262 |
4/8boost::capy::buffer_array<2ul, false>::operator=(boost::capy::buffer_array<2ul, false> const&):
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
boost::capy::buffer_array<2ul, true>::operator=(boost::capy::buffer_array<2ul, true> const&):
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
boost::capy::buffer_array<4ul, false>::operator=(boost::capy::buffer_array<4ul, false> const&):
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
boost::capy::buffer_array<4ul, true>::operator=(boost::capy::buffer_array<4ul, true> const&):
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
4x | while(n_--) | |
| 263 | ✗ | arr_[n_].~value_type(); | ||
| 264 | 4x | n_ = other.n_; | ||
| 265 | 4x | size_ = other.size_; | ||
| 266 |
8/8boost::capy::buffer_array<2ul, false>::operator=(boost::capy::buffer_array<2ul, false> const&):
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 time.
boost::capy::buffer_array<2ul, true>::operator=(boost::capy::buffer_array<2ul, true> const&):
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 time.
boost::capy::buffer_array<4ul, false>::operator=(boost::capy::buffer_array<4ul, false> const&):
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 1 time.
boost::capy::buffer_array<4ul, true>::operator=(boost::capy::buffer_array<4ul, true> const&):
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 1 time.
|
10x | for(std::size_t i = 0; i < n_; ++i) | |
| 267 | 6x | ::new(&arr_[i]) value_type(other.arr_[i]); | ||
| 268 | } | |||
| 269 | 4x | return *this; | ||
| 270 | } | |||
| 271 | ||||
| 272 | /** Return an iterator to the beginning. | |||
| 273 | */ | |||
| 274 | value_type* | |||
| 275 | 8834x | begin() noexcept | ||
| 276 | { | |||
| 277 | 8834x | return arr_; | ||
| 278 | } | |||
| 279 | ||||
| 280 | /** Return an iterator to the beginning. | |||
| 281 | */ | |||
| 282 | value_type const* | |||
| 283 | 11022x | begin() const noexcept | ||
| 284 | { | |||
| 285 | 11022x | return arr_; | ||
| 286 | } | |||
| 287 | ||||
| 288 | /** Return an iterator to the end. | |||
| 289 | */ | |||
| 290 | value_type* | |||
| 291 | 8833x | end() noexcept | ||
| 292 | { | |||
| 293 | 8833x | return arr_ + n_; | ||
| 294 | } | |||
| 295 | ||||
| 296 | /** Return an iterator to the end. | |||
| 297 | */ | |||
| 298 | value_type const* | |||
| 299 | 11022x | end() const noexcept | ||
| 300 | { | |||
| 301 | 11022x | return arr_ + n_; | ||
| 302 | } | |||
| 303 | ||||
| 304 | /** Return a span of the buffers. | |||
| 305 | */ | |||
| 306 | std::span<value_type> | |||
| 307 | 379x | to_span() noexcept | ||
| 308 | { | |||
| 309 | 379x | return { arr_, n_ }; | ||
| 310 | } | |||
| 311 | ||||
| 312 | /** Return a span of the buffers. | |||
| 313 | */ | |||
| 314 | std::span<value_type const> | |||
| 315 | 175x | to_span() const noexcept | ||
| 316 | { | |||
| 317 | 175x | return { arr_, n_ }; | ||
| 318 | } | |||
| 319 | ||||
| 320 | /** Conversion to mutable span. | |||
| 321 | */ | |||
| 322 | 1x | operator std::span<value_type>() noexcept | ||
| 323 | { | |||
| 324 | 1x | return { arr_, n_ }; | ||
| 325 | } | |||
| 326 | ||||
| 327 | /** Conversion to const span. | |||
| 328 | */ | |||
| 329 | operator std::span<value_type const>() const noexcept | |||
| 330 | { | |||
| 331 | return { arr_, n_ }; | |||
| 332 | } | |||
| 333 | ||||
| 334 | /** Return the total byte count in O(1). | |||
| 335 | */ | |||
| 336 | friend | |||
| 337 | std::size_t | |||
| 338 | 5499x | tag_invoke( | ||
| 339 | size_tag const&, | |||
| 340 | buffer_array const& ba) noexcept | |||
| 341 | { | |||
| 342 | 5499x | return ba.size_; | ||
| 343 | } | |||
| 344 | ||||
| 345 | /** Slice customization point. | |||
| 346 | */ | |||
| 347 | friend | |||
| 348 | void | |||
| 349 | 2080x | tag_invoke( | ||
| 350 | slice_tag const&, | |||
| 351 | buffer_array& ba, | |||
| 352 | slice_how how, | |||
| 353 | std::size_t n) noexcept | |||
| 354 | { | |||
| 355 | 2080x | ba.slice_impl(how, n); | ||
| 356 | 2080x | } | ||
| 357 | ||||
| 358 | private: | |||
| 359 | void | |||
| 360 | 2080x | slice_impl( | ||
| 361 | slice_how how, | |||
| 362 | std::size_t n) noexcept | |||
| 363 | { | |||
| 364 |
4/6boost::capy::buffer_array<4ul, false>::slice_impl(boost::capy::slice_how, unsigned long):
✓ Branch 0 taken 512 times.
✓ Branch 1 taken 528 times.
✗ Branch 2 not taken.
boost::capy::buffer_array<4ul, true>::slice_impl(boost::capy::slice_how, unsigned long):
✓ Branch 0 taken 512 times.
✓ Branch 1 taken 528 times.
✗ Branch 2 not taken.
|
2080x | switch(how) | |
| 365 | { | |||
| 366 | 1024x | case slice_how::remove_prefix: | ||
| 367 | 1024x | remove_prefix_impl(n); | ||
| 368 | 1024x | break; | ||
| 369 | ||||
| 370 | 1056x | case slice_how::keep_prefix: | ||
| 371 | 1056x | keep_prefix_impl(n); | ||
| 372 | 1056x | break; | ||
| 373 | } | |||
| 374 | 2080x | } | ||
| 375 | ||||
| 376 | void | |||
| 377 | 1024x | remove_prefix_impl(std::size_t n) noexcept | ||
| 378 | { | |||
| 379 | 1024x | detail::buffer_array_remove_prefix(arr_, &n_, &size_, n); | ||
| 380 | 1024x | } | ||
| 381 | ||||
| 382 | void | |||
| 383 | 1056x | keep_prefix_impl(std::size_t n) noexcept | ||
| 384 | { | |||
| 385 | 1056x | detail::buffer_array_keep_prefix(arr_, &n_, &size_, n); | ||
| 386 | 1056x | } | ||
| 387 | }; | |||
| 388 | ||||
| 389 | //------------------------------------------------ | |||
| 390 | ||||
| 391 | /** Alias for buffer_array holding const_buffer. | |||
| 392 | ||||
| 393 | @tparam N Maximum number of buffers. | |||
| 394 | */ | |||
| 395 | template<std::size_t N> | |||
| 396 | using const_buffer_array = buffer_array<N, true>; | |||
| 397 | ||||
| 398 | /** Alias for buffer_array holding mutable_buffer. | |||
| 399 | ||||
| 400 | @tparam N Maximum number of buffers. | |||
| 401 | */ | |||
| 402 | template<std::size_t N> | |||
| 403 | using mutable_buffer_array = buffer_array<N, false>; | |||
| 404 | ||||
| 405 | } // namespace capy | |||
| 406 | } // namespace boost | |||
| 407 | ||||
| 408 | #endif | |||
| 409 |