100.00% Lines (88/88) 100.00% Functions (19/19)
TLA Baseline Branch
Line Hits Code Line Hits Code
1   // 1   //
2   // Copyright (c) 2026 Steve Gerbino 2   // Copyright (c) 2026 Steve Gerbino
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/capy 7   // Official repository: https://github.com/cppalliance/capy
8   // 8   //
9   9  
10   #ifndef BOOST_CAPY_BUFFERS_BUFFERS_ITERATOR_HPP 10   #ifndef BOOST_CAPY_BUFFERS_BUFFERS_ITERATOR_HPP
11   #define BOOST_CAPY_BUFFERS_BUFFERS_ITERATOR_HPP 11   #define BOOST_CAPY_BUFFERS_BUFFERS_ITERATOR_HPP
12   12  
13   #include <boost/capy/detail/config.hpp> 13   #include <boost/capy/detail/config.hpp>
14   #include <boost/capy/buffers.hpp> 14   #include <boost/capy/buffers.hpp>
15   15  
16   #include <compare> 16   #include <compare>
17   #include <cstddef> 17   #include <cstddef>
18   #include <iterator> 18   #include <iterator>
19   #include <ranges> 19   #include <ranges>
20   #include <type_traits> 20   #include <type_traits>
21   #include <utility> 21   #include <utility>
22   22  
23   namespace boost { 23   namespace boost {
24   namespace capy { 24   namespace capy {
25   25  
26   namespace detail { 26   namespace detail {
27   27  
28   // Walking back from the end needs an end iterator, not a sentinel 28   // Walking back from the end needs an end iterator, not a sentinel
29   template<class T> 29   template<class T>
30   concept common_buffer_sequence = 30   concept common_buffer_sequence =
31   ConstBufferSequence<T> && 31   ConstBufferSequence<T> &&
32   (ConstBuffer<T> || std::ranges::common_range<T const>); 32   (ConstBuffer<T> || std::ranges::common_range<T const>);
33   33  
34   } // detail 34   } // detail
35   35  
36 - /** A random access iterator over the bytes in a buffer sequence. 36 + /** Iterate over the bytes of a buffer sequence as one continuous run.
37   37  
38   A buffer sequence stores its bytes in several separate regions. 38   A buffer sequence stores its bytes in several separate regions.
39 - This iterator presents them as one run of bytes, so standard 39 + This iterator presents them as one run of bytes. Standard
40 - algorithms such as `std::search` can scan across the boundaries 40 + algorithms such as `std::search` can then scan across the
41 - between buffers without first copying the data into contiguous 41 + boundaries between buffers without first copying the data into
42 - storage. Empty buffers in the sequence are skipped. 42 + contiguous storage. Empty buffers in the sequence are skipped.
  43 +
  44 + The iterator provides the random access operations and tag. It does
  45 + not meet the constant time requirement of a random access iterator.
43   46  
44   The iterator dereferences to `ByteType&` for a 47   The iterator dereferences to `ByteType&` for a
45   @ref MutableBufferSequence and to `ByteType const&` otherwise. 48   @ref MutableBufferSequence and to `ByteType const&` otherwise.
46   49  
47 - Moving by `n` bytes walks the underlying buffers, so `operator+=`, 50 + Moving by `n` bytes walks the underlying buffers. The operators that
48 - `operator-=`, `operator+`, `operator-` with an integer, and 51 + move by an integer are linear in the number of buffers crossed.
49 - `operator[]` are linear in the number of buffers crossed. Comparison 52 + These are `operator+=`, `operator-=`, `operator+`, `operator-` with
50 - and the difference of two iterators are constant time. 53 + an integer, and `operator[]`. Comparison and the difference of two
  54 + iterators are constant time.
51   55  
52 - @par Preconditions 56 + @pre The buffer sequence and the memory it refers to outlive every
53 - The buffer sequence and the memory it refers to outlive every 57 + iterator obtained from it.
54 - iterator obtained from it. Iterators from different sequences are 58 + @pre The sequence's buffers are not changed, and its iterators are
55 - not comparable. 59 + not invalidated, while an iterator obtained from it is in use.
  60 + @pre Iterators compared or subtracted come from the same sequence.
56   61  
57   @par Example 62   @par Example
58   @code 63   @code
59   std::array<capy::const_buffer, 2> bufs{ 64   std::array<capy::const_buffer, 2> bufs{
60   capy::make_buffer(std::string_view("GET / HTTP/1.1\r")), 65   capy::make_buffer(std::string_view("GET / HTTP/1.1\r")),
61   capy::make_buffer(std::string_view("\n\r\nbody")) }; 66   capy::make_buffer(std::string_view("\n\r\nbody")) };
62   67  
63   // Find the end of the header, which spans both buffers 68   // Find the end of the header, which spans both buffers
64   char const crlfcrlf[] = "\r\n\r\n"; 69   char const crlfcrlf[] = "\r\n\r\n";
65   auto it = std::search( 70   auto it = std::search(
66   capy::buffers_begin(bufs), capy::buffers_end(bufs), 71   capy::buffers_begin(bufs), capy::buffers_end(bufs),
67   crlfcrlf, crlfcrlf + 4); 72   crlfcrlf, crlfcrlf + 4);
68   std::size_t header_size = it - capy::buffers_begin(bufs) + 4; 73   std::size_t header_size = it - capy::buffers_begin(bufs) + 4;
69   @endcode 74   @endcode
70   75  
71   @tparam BufferSequence The buffer sequence type. It must be a single 76   @tparam BufferSequence The buffer sequence type. It must be a single
72   buffer, or a range of buffers whose begin and end have the same type. 77   buffer, or a range of buffers whose begin and end have the same type.
73   78  
74   @tparam ByteType The byte type presented by the iterator. Its size 79   @tparam ByteType The byte type presented by the iterator. Its size
75   must be 1. 80   must be 1.
76   81  
77   @see @ref buffers_begin, @ref buffers_end, 82   @see @ref buffers_begin, @ref buffers_end,
78   @ref buffer_sequence_begin 83   @ref buffer_sequence_begin
79   */ 84   */
80   template<class BufferSequence, class ByteType = char> 85   template<class BufferSequence, class ByteType = char>
81   requires detail::common_buffer_sequence<BufferSequence> 86   requires detail::common_buffer_sequence<BufferSequence>
82   class buffers_iterator 87   class buffers_iterator
83   { 88   {
84   static_assert(sizeof(ByteType) == 1, "ByteType must be a byte"); 89   static_assert(sizeof(ByteType) == 1, "ByteType must be a byte");
85   90  
86   using sequence_iterator = decltype( 91   using sequence_iterator = decltype(
87   buffer_sequence_begin(std::declval<BufferSequence const&>())); 92   buffer_sequence_begin(std::declval<BufferSequence const&>()));
88   using buffer_type = capy::buffer_type<BufferSequence>; 93   using buffer_type = capy::buffer_type<BufferSequence>;
89   using byte_type = std::conditional_t< 94   using byte_type = std::conditional_t<
90   MutableBufferSequence<BufferSequence>, 95   MutableBufferSequence<BufferSequence>,
91   ByteType, 96   ByteType,
92   ByteType const>; 97   ByteType const>;
93   98  
94   buffer_type current_buffer_{}; 99   buffer_type current_buffer_{};
95   std::size_t current_buffer_position_ = 0; 100   std::size_t current_buffer_position_ = 0;
96   sequence_iterator current_{}; 101   sequence_iterator current_{};
97   sequence_iterator end_{}; 102   sequence_iterator end_{};
98   std::size_t position_ = 0; 103   std::size_t position_ = 0;
99   104  
100   // Move to the next non-empty buffer, or to the end of the sequence 105   // Move to the next non-empty buffer, or to the end of the sequence
101   void 106   void
HITCBC 102   202 skip_forward() noexcept 107   202 skip_forward() noexcept
103   { 108   {
HITCBC 104   363 while(current_ != end_) 109   363 while(current_ != end_)
105   { 110   {
HITCBC 106   334 current_buffer_ = buffer_type(*current_); 111   334 current_buffer_ = buffer_type(*current_);
HITCBC 107   334 if(current_buffer_.size() > 0) 112   334 if(current_buffer_.size() > 0)
HITCBC 108   173 return; 113   173 return;
HITCBC 109   161 ++current_; 114   161 ++current_;
110   } 115   }
HITCBC 111   29 current_buffer_ = {}; 116   29 current_buffer_ = {};
112   } 117   }
113   118  
114   // Move to the previous non-empty buffer, positioned past its last byte 119   // Move to the previous non-empty buffer, positioned past its last byte
115   void 120   void
HITCBC 116   155 skip_backward() noexcept 121   155 skip_backward() noexcept
117   { 122   {
118   do 123   do
119   { 124   {
HITCBC 120   277 --current_; 125   277 --current_;
HITCBC 121   277 current_buffer_ = buffer_type(*current_); 126   277 current_buffer_ = buffer_type(*current_);
122   } 127   }
HITCBC 123   277 while(current_buffer_.size() == 0); 128   277 while(current_buffer_.size() == 0);
HITCBC 124   155 current_buffer_position_ = current_buffer_.size(); 129   155 current_buffer_position_ = current_buffer_.size();
HITCBC 125   155 } 130   155 }
126   131  
127   void 132   void
HITCBC 128   318 advance(std::ptrdiff_t n) noexcept 133   318 advance(std::ptrdiff_t n) noexcept
129   { 134   {
HITCBC 130   318 if(n >= 0) 135   318 if(n >= 0)
131   { 136   {
HITCBC 132   177 auto left = static_cast<std::size_t>(n); 137   177 auto left = static_cast<std::size_t>(n);
HITCBC 133   349 while(left > 0) 138   349 while(left > 0)
134   { 139   {
HITCBC 135   269 std::size_t const avail = 140   269 std::size_t const avail =
HITCBC 136   269 current_buffer_.size() - current_buffer_position_; 141   269 current_buffer_.size() - current_buffer_position_;
HITCBC 137   269 if(left < avail) 142   269 if(left < avail)
138   { 143   {
HITCBC 139   97 current_buffer_position_ += left; 144   97 current_buffer_position_ += left;
HITCBC 140   97 position_ += left; 145   97 position_ += left;
HITCBC 141   97 return; 146   97 return;
142   } 147   }
HITCBC 143   172 left -= avail; 148   172 left -= avail;
HITCBC 144   172 position_ += avail; 149   172 position_ += avail;
HITCBC 145   172 ++current_; 150   172 ++current_;
HITCBC 146   172 current_buffer_position_ = 0; 151   172 current_buffer_position_ = 0;
HITCBC 147   172 skip_forward(); 152   172 skip_forward();
148   } 153   }
149   } 154   }
150   else 155   else
151   { 156   {
HITCBC 152   141 auto left = static_cast<std::size_t>(-n); 157   141 auto left = static_cast<std::size_t>(-n);
HITCBC 153   296 while(left > 0) 158   296 while(left > 0)
154   { 159   {
HITCBC 155   296 if(left <= current_buffer_position_) 160   296 if(left <= current_buffer_position_)
156   { 161   {
HITCBC 157   141 current_buffer_position_ -= left; 162   141 current_buffer_position_ -= left;
HITCBC 158   141 position_ -= left; 163   141 position_ -= left;
HITCBC 159   141 return; 164   141 return;
160   } 165   }
HITCBC 161   155 left -= current_buffer_position_; 166   155 left -= current_buffer_position_;
HITCBC 162   155 position_ -= current_buffer_position_; 167   155 position_ -= current_buffer_position_;
HITCBC 163   155 skip_backward(); 168   155 skip_backward();
164   } 169   }
165   } 170   }
166   } 171   }
167   172  
168   public: 173   public:
169   /// The signed type of the distance between two iterators. 174   /// The signed type of the distance between two iterators.
170   using difference_type = std::ptrdiff_t; 175   using difference_type = std::ptrdiff_t;
171   176  
172   /// The type of the bytes the iterator visits. 177   /// The type of the bytes the iterator visits.
173   using value_type = ByteType; 178   using value_type = ByteType;
174   179  
175   /// The type returned by `operator->`. 180   /// The type returned by `operator->`.
176   using pointer = byte_type*; 181   using pointer = byte_type*;
177   182  
178   /// The type returned by `operator*`. 183   /// The type returned by `operator*`.
179   using reference = byte_type&; 184   using reference = byte_type&;
180   185  
181   /// The iterator category. 186   /// The iterator category.
182   using iterator_category = std::random_access_iterator_tag; 187   using iterator_category = std::random_access_iterator_tag;
183   188  
184   /// Construct a singular iterator. 189   /// Construct a singular iterator.
HITCBC 185   14 buffers_iterator() = default; 190   14 buffers_iterator() = default;
186   191  
187   /** Return an iterator to the first byte of a buffer sequence. 192   /** Return an iterator to the first byte of a buffer sequence.
188   193  
189   @param bs The buffer sequence. It must outlive the iterator. 194   @param bs The buffer sequence. It must outlive the iterator.
190   195  
191   @return An iterator to the first byte, or the end iterator if 196   @return An iterator to the first byte, or the end iterator if
192   the sequence holds no bytes. 197   the sequence holds no bytes.
193   */ 198   */
194   static 199   static
195   buffers_iterator 200   buffers_iterator
HITCBC 196   18 begin(BufferSequence const& bs) noexcept 201   18 begin(BufferSequence const& bs) noexcept
197   { 202   {
HITCBC 198   18 buffers_iterator it; 203   18 buffers_iterator it;
HITCBC 199   18 it.current_ = buffer_sequence_begin(bs); 204   18 it.current_ = buffer_sequence_begin(bs);
HITCBC 200   18 it.end_ = buffer_sequence_end(bs); 205   18 it.end_ = buffer_sequence_end(bs);
HITCBC 201   18 it.skip_forward(); 206   18 it.skip_forward();
HITCBC 202   18 return it; 207   18 return it;
203   } 208   }
204   209  
205   /** Return an iterator past the last byte of a buffer sequence. 210   /** Return an iterator past the last byte of a buffer sequence.
206   211  
207   @param bs The buffer sequence. It must outlive the iterator. 212   @param bs The buffer sequence. It must outlive the iterator.
208   213  
209   @return The end iterator. 214   @return The end iterator.
210   */ 215   */
211   static 216   static
212   buffers_iterator 217   buffers_iterator
HITCBC 213   24 end(BufferSequence const& bs) noexcept 218   24 end(BufferSequence const& bs) noexcept
214   { 219   {
HITCBC 215   24 buffers_iterator it; 220   24 buffers_iterator it;
HITCBC 216   24 it.current_ = buffer_sequence_end(bs); 221   24 it.current_ = buffer_sequence_end(bs);
HITCBC 217   24 it.end_ = it.current_; 222   24 it.end_ = it.current_;
HITCBC 218   24 it.position_ = buffer_size(bs); 223   24 it.position_ = buffer_size(bs);
HITCBC 219   24 return it; 224   24 return it;
220   } 225   }
221   226  
222   /** Return a reference to the current byte. 227   /** Return a reference to the current byte.
223   228  
224 - @par Preconditions 229 + @pre The iterator is not the end iterator.
225 - The iterator is not the end iterator.  
226   */ 230   */
227   reference 231   reference
HITCBC 228   125 operator*() const noexcept 232   125 operator*() const noexcept
229   { 233   {
230   return static_cast<pointer>( 234   return static_cast<pointer>(
HITCBC 231   125 current_buffer_.data())[current_buffer_position_]; 235   125 current_buffer_.data())[current_buffer_position_];
232   } 236   }
233   237  
234   /** Return a pointer to the current byte. 238   /** Return a pointer to the current byte.
235   239  
236 - @par Preconditions 240 + @pre The iterator is not the end iterator.
237 - The iterator is not the end iterator.  
238   */ 241   */
239   pointer 242   pointer
240   operator->() const noexcept 243   operator->() const noexcept
241   { 244   {
242   return &**this; 245   return &**this;
243   } 246   }
244   247  
245   /** Return a reference to the byte `n` positions away. 248   /** Return a reference to the byte `n` positions away.
246   249  
247   @par Complexity 250   @par Complexity
248   Linear in the number of buffers crossed. 251   Linear in the number of buffers crossed.
249   252  
250   @param n The offset from this iterator, in bytes. 253   @param n The offset from this iterator, in bytes.
  254 +
  255 + @return A reference to the byte at `*this + n`.
251   */ 256   */
252   reference 257   reference
HITCBC 253   33 operator[](difference_type n) const noexcept 258   33 operator[](difference_type n) const noexcept
254   { 259   {
HITCBC 255   33 return *(*this + n); 260   33 return *(*this + n);
256   } 261   }
257   262  
258   /// Advance to the next byte. 263   /// Advance to the next byte.
259   buffers_iterator& 264   buffers_iterator&
HITCBC 260   59 operator++() noexcept 265   59 operator++() noexcept
261   { 266   {
HITCBC 262   59 ++position_; 267   59 ++position_;
HITCBC 263   59 if(++current_buffer_position_ < current_buffer_.size()) 268   59 if(++current_buffer_position_ < current_buffer_.size())
HITCBC 264   47 return *this; 269   47 return *this;
HITCBC 265   12 ++current_; 270   12 ++current_;
HITCBC 266   12 current_buffer_position_ = 0; 271   12 current_buffer_position_ = 0;
HITCBC 267   12 skip_forward(); 272   12 skip_forward();
HITCBC 268   12 return *this; 273   12 return *this;
269   } 274   }
270   275  
271   /// Advance to the next byte, returning the previous position. 276   /// Advance to the next byte, returning the previous position.
272   buffers_iterator 277   buffers_iterator
273   operator++(int) noexcept 278   operator++(int) noexcept
274   { 279   {
275   auto tmp = *this; 280   auto tmp = *this;
276   ++*this; 281   ++*this;
277   return tmp; 282   return tmp;
278   } 283   }
279   284  
280   /// Move back to the previous byte. 285   /// Move back to the previous byte.
281   buffers_iterator& 286   buffers_iterator&
HITCBC 282   20 operator--() noexcept 287   20 operator--() noexcept
283   { 288   {
HITCBC 284   20 advance(-1); 289   20 advance(-1);
HITCBC 285   20 return *this; 290   20 return *this;
286   } 291   }
287   292  
288   /// Move back to the previous byte, returning the previous position. 293   /// Move back to the previous byte, returning the previous position.
289   buffers_iterator 294   buffers_iterator
290   operator--(int) noexcept 295   operator--(int) noexcept
291   { 296   {
292   auto tmp = *this; 297   auto tmp = *this;
293   --*this; 298   --*this;
294   return tmp; 299   return tmp;
295   } 300   }
296   301  
297   /** Move by `n` bytes. 302   /** Move by `n` bytes.
298   303  
299   @par Complexity 304   @par Complexity
300   Linear in the number of buffers crossed. 305   Linear in the number of buffers crossed.
301   306  
302   @param n The number of bytes to move; negative moves backward. 307   @param n The number of bytes to move; negative moves backward.
303   308  
304   @return A reference to `*this`. 309   @return A reference to `*this`.
305   */ 310   */
306   buffers_iterator& 311   buffers_iterator&
HITCBC 307   166 operator+=(difference_type n) noexcept 312   166 operator+=(difference_type n) noexcept
308   { 313   {
HITCBC 309   166 advance(n); 314   166 advance(n);
HITCBC 310   166 return *this; 315   166 return *this;
311   } 316   }
312   317  
313   /** Move back by `n` bytes. 318   /** Move back by `n` bytes.
314   319  
315   @par Complexity 320   @par Complexity
316   Linear in the number of buffers crossed. 321   Linear in the number of buffers crossed.
317   322  
318   @param n The number of bytes to move back. 323   @param n The number of bytes to move back.
319   324  
320   @return A reference to `*this`. 325   @return A reference to `*this`.
321   */ 326   */
322   buffers_iterator& 327   buffers_iterator&
HITCBC 323   132 operator-=(difference_type n) noexcept 328   132 operator-=(difference_type n) noexcept
324   { 329   {
HITCBC 325   132 advance(-n); 330   132 advance(-n);
HITCBC 326   132 return *this; 331   132 return *this;
327   } 332   }
328   333  
329   /// Return an iterator `n` bytes after `it`. 334   /// Return an iterator `n` bytes after `it`.
330   friend 335   friend
331   buffers_iterator 336   buffers_iterator
HITCBC 332   166 operator+(buffers_iterator it, difference_type n) noexcept 337   166 operator+(buffers_iterator it, difference_type n) noexcept
333   { 338   {
HITCBC 334   166 it += n; 339   166 it += n;
HITCBC 335   166 return it; 340   166 return it;
336   } 341   }
337   342  
338   /// Return an iterator `n` bytes after `it`. 343   /// Return an iterator `n` bytes after `it`.
339   friend 344   friend
340   buffers_iterator 345   buffers_iterator
341   operator+(difference_type n, buffers_iterator it) noexcept 346   operator+(difference_type n, buffers_iterator it) noexcept
342   { 347   {
343   it += n; 348   it += n;
344   return it; 349   return it;
345   } 350   }
346   351  
347   /// Return an iterator `n` bytes before `it`. 352   /// Return an iterator `n` bytes before `it`.
348   friend 353   friend
349   buffers_iterator 354   buffers_iterator
HITCBC 350   11 operator-(buffers_iterator it, difference_type n) noexcept 355   11 operator-(buffers_iterator it, difference_type n) noexcept
351   { 356   {
HITCBC 352   11 it -= n; 357   11 it -= n;
HITCBC 353   11 return it; 358   11 return it;
354   } 359   }
355   360  
356   /// Return the number of bytes from `b` to `a`. 361   /// Return the number of bytes from `b` to `a`.
357   friend 362   friend
358   difference_type 363   difference_type
HITCBC 359   264 operator-( 364   264 operator-(
360   buffers_iterator const& a, 365   buffers_iterator const& a,
361   buffers_iterator const& b) noexcept 366   buffers_iterator const& b) noexcept
362   { 367   {
HITCBC 363   264 return static_cast<difference_type>(a.position_) - 368   264 return static_cast<difference_type>(a.position_) -
HITCBC 364   264 static_cast<difference_type>(b.position_); 369   264 static_cast<difference_type>(b.position_);
365   } 370   }
366   371  
367   /// Test whether two iterators refer to the same byte. 372   /// Test whether two iterators refer to the same byte.
368   friend 373   friend
369   bool 374   bool
HITCBC 370   312 operator==( 375   312 operator==(
371   buffers_iterator const& a, 376   buffers_iterator const& a,
372   buffers_iterator const& b) noexcept 377   buffers_iterator const& b) noexcept
373   { 378   {
HITCBC 374   312 return a.position_ == b.position_; 379   312 return a.position_ == b.position_;
375   } 380   }
376   381  
377   /// Order two iterators by byte position. 382   /// Order two iterators by byte position.
378   friend 383   friend
379   std::strong_ordering 384   std::strong_ordering
HITCBC 380   121 operator<=>( 385   121 operator<=>(
381   buffers_iterator const& a, 386   buffers_iterator const& a,
382   buffers_iterator const& b) noexcept 387   buffers_iterator const& b) noexcept
383   { 388   {
HITCBC 384   121 return a.position_ <=> b.position_; 389   121 return a.position_ <=> b.position_;
385   } 390   }
386   }; 391   };
387   392  
388   /** Return an iterator to the first byte of a buffer sequence. 393   /** Return an iterator to the first byte of a buffer sequence.
389   394  
390   @param bs The buffer sequence. It must outlive the iterator. 395   @param bs The buffer sequence. It must outlive the iterator.
391   396  
392 - @return `buffers_iterator<BufferSequence>::begin(bs)`. 397 + @return An iterator to the first byte of `bs`.
393   398  
394   @see @ref buffers_iterator, @ref buffers_end 399   @see @ref buffers_iterator, @ref buffers_end
395   */ 400   */
396   template<detail::common_buffer_sequence BufferSequence> 401   template<detail::common_buffer_sequence BufferSequence>
397   buffers_iterator<BufferSequence> 402   buffers_iterator<BufferSequence>
HITCBC 398   17 buffers_begin(BufferSequence const& bs) noexcept 403   17 buffers_begin(BufferSequence const& bs) noexcept
399   { 404   {
HITCBC 400   17 return buffers_iterator<BufferSequence>::begin(bs); 405   17 return buffers_iterator<BufferSequence>::begin(bs);
401   } 406   }
402   407  
403   /// Rejects a temporary sequence, since the iterator would dangle. 408   /// Rejects a temporary sequence, since the iterator would dangle.
404   template<detail::common_buffer_sequence BufferSequence> 409   template<detail::common_buffer_sequence BufferSequence>
405   buffers_iterator<BufferSequence> 410   buffers_iterator<BufferSequence>
406   buffers_begin(BufferSequence const&& bs) = delete; 411   buffers_begin(BufferSequence const&& bs) = delete;
407   412  
408   /** Return an iterator past the last byte of a buffer sequence. 413   /** Return an iterator past the last byte of a buffer sequence.
409   414  
410   @param bs The buffer sequence. It must outlive the iterator. 415   @param bs The buffer sequence. It must outlive the iterator.
411   416  
412 - @return `buffers_iterator<BufferSequence>::end(bs)`. 417 + @return The end iterator for `bs`.
413   418  
414   @see @ref buffers_iterator, @ref buffers_begin 419   @see @ref buffers_iterator, @ref buffers_begin
415   */ 420   */
416   template<detail::common_buffer_sequence BufferSequence> 421   template<detail::common_buffer_sequence BufferSequence>
417   buffers_iterator<BufferSequence> 422   buffers_iterator<BufferSequence>
HITCBC 418   24 buffers_end(BufferSequence const& bs) noexcept 423   24 buffers_end(BufferSequence const& bs) noexcept
419   { 424   {
HITCBC 420   24 return buffers_iterator<BufferSequence>::end(bs); 425   24 return buffers_iterator<BufferSequence>::end(bs);
421   } 426   }
422   427  
423   /// Rejects a temporary sequence, since the iterator would dangle. 428   /// Rejects a temporary sequence, since the iterator would dangle.
424   template<detail::common_buffer_sequence BufferSequence> 429   template<detail::common_buffer_sequence BufferSequence>
425   buffers_iterator<BufferSequence> 430   buffers_iterator<BufferSequence>
426   buffers_end(BufferSequence const&& bs) = delete; 431   buffers_end(BufferSequence const&& bs) = delete;
427   432  
428   } // capy 433   } // capy
429   } // boost 434   } // boost
430   435  
431   #endif 436   #endif