You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/implementation_status.md
+35-21Lines changed: 35 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,17 @@ This library is a **work-in-progress**.
4
4
We try to stay close to standard library interfaces, but we neither promise full API compatibility with `std::ranges::` nor do we currently promise stability between releases of this library.
5
5
The latter will likely change at some point.
6
6
7
+
### Progress implementing std::views::X equivalents (adaptor objects and factory objects)
Copy file name to clipboardExpand all lines: include/radr/rad/split.hpp
+50-2Lines changed: 50 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -13,12 +13,14 @@
13
13
#pragma once
14
14
15
15
#include<iterator>
16
+
#include<ranges>
16
17
17
18
#include"radr/custom/subborrow.hpp"
18
19
#include"radr/detail/detail.hpp"
19
20
#include"radr/detail/pipe.hpp"
20
21
#include"radr/factory/single.hpp"
21
22
#include"radr/rad/as_const.hpp"
23
+
#include"radr/rad/to_single_pass.hpp"
22
24
#include"radr/range_access.hpp"
23
25
24
26
namespaceradr::detail
@@ -305,25 +307,71 @@ inline namespace cpo
305
307
{
306
308
307
309
/*!\brief radr::split(urange, pattern)
310
+
* \tparam URange Type of \p urange.
311
+
* \tparam Patttern Type of \p pattern.
308
312
* \param urange The underlying range.
309
313
* \param pattern The pattern to split by.
310
314
* \details
311
315
*
316
+
* Turns a range into a range-of-ranges, by splitting on the provided pattern.
317
+
* The pattern will not be included in the output.
318
+
*
312
319
* ## Multi-pass ranges
313
320
*
314
321
* The pattern can be one of:
315
322
* * a std::ref-wrapped lvalue of a range whose elements are comparable to the underlying range.
316
323
* * an rvalue of a range whose elements are comparable to the underlying range (only if the pattern is a borrowed_mp_range).
317
324
* * a std::ref-wrapped lvalue of a delimiter element that is comparable to elements of the underlying range.
318
325
* * an rvalue of a delimiter element that is comparable to elements of the underlying range (only if that value is default constructible and copyable without throwing).
326
+
* * Note that string-literal patterns (`"foobar"`) are not supported. Use string_views instead (`"foobar"sv`).
327
+
*
328
+
* Requirements:
329
+
* * `radr::mp_range<URange>`
330
+
* * for Pattern, see above.
331
+
*
332
+
* The returned "outer range"-type models radr::mp_range and preserves std::ranges::borrowed_range.
333
+
* It is never bidirectional, common, sized or mutable.
334
+
*
335
+
* The returned "inner range"-type is created via the radr::subborrow customisation point.
336
+
* Unless customised otherwise, it always models:
337
+
* * std::ranges::borrowed_range
338
+
* * std::ranges::sized_range
339
+
* * radr::common_range
340
+
*
341
+
* It preserves from the underlying range:
342
+
* * categories up to std::ranges::contiguous_range
343
+
* * radr::mutable_range
344
+
* * radr::constant_range
345
+
*
346
+
* Construction of the adaptor is in O(n), because the first inner range is searched on construction
347
+
* (which could be the full range).
319
348
*
320
-
* Note that string-literal patterns (`"foobar"`) are not supported. Use string_views instead (`"foobar"sv`).
349
+
* ### Notable differences to std::views::split
350
+
*
351
+
* Due to radr::subborrow being used, splitting a string_view results in string_views:
352
+
*
353
+
* ```cpp
354
+
* auto subs = "foo bar bax"sv | radr::split(' ');
355
+
* auto frst = *subs.begin(); // this is a string_view, too
356
+
* ```
321
357
*
322
358
* ## Single-pass ranges
323
359
*
324
-
* The pattern can be delimiter element (rvalue or lvalue) comparable to the elements of the underlying range.
360
+
* The pattern must be delimiter element (rvalue or lvalue) comparable to the elements of the underlying range.
361
+
* Ranges as patterns are not supported for single-pass inputs.
0 commit comments