Hi all,

I'm wondering if we should also support slice(1) or slice(1, 10, 3), i.e.:

views::slice(1)        -> views::drop(1)
views::slice(1, 10)    -> views::drop(1) | views::take(9)
views::slice(1, 10, 3) -> views::drop(1) | views::take(9) | views::strde(3)

Although this may be confused with std::strided_slice ([mdspan.submdspan.strided.slice]) (or std::slice [class.slice.overview]), because the second argument of the latter is not the end but the extent, so views::slice(1, 10, 3) will get 1, 4, 7, while strided_slice(1, 10, 3) will get 1, 4, 7, 10.

What do you think? Would it make sense to provide two more variants for views::slice?


Hewill Kang <hewillk@gmail.com> 於 2024年4月1日 週一 下午7:57寫道:
Hi all,

I wrote a draft for C++26 range adaptor views::slice, you can see it here https://isocpp.org/files/papers/D3216R0.html
Since this is a draft, there may be some missing points that have not been considered, or there is room for improvement in wording.
Comments are welcome.