On Tue, Sep 30, 2025 at 9:47 AM Luc Grosheintz <[email protected]> wrote:
> > > On 9/30/25 8:53 AM, Tomasz Kaminski wrote: > > On Tue, Sep 30, 2025 at 8:30 AM Luc Grosheintz <[email protected] > > > > wrote: > > > >> > >> > >> On 9/29/25 5:18 PM, Jonathan Wakely wrote: > >>>> > >>>> The question is should it support custom types that aren't copyable? > >>>> (Everything is much easier if all types are move and copy > >>>> constructable). > >>>> > >>> > >>> I think this is in flux, via P3663, which is being reviewed by LWG at > the > >>> moment. The latest draft (with a lot of input from Tomasz) is > >>> https://isocpp.org/files/papers/D3663R3.html > >>> > >> > >> Thank you, that's interesting. I'll read it again more carefully, but > >> it looks like the proposed casting layer is sensible; and might get > >> added via P3663 (they call it canonicalization). I'll finish a v1 > >> with the casting layer. > >> > > My suggestion here would be to implement what P3663 is proposing > > from the start. This is only observable for user-defined mappings, as > they > > will no longer obser other slice types than canonical ones. > > > > As the paper touches a lot of wording, we have fixed some of the issues > > as the drive-by there. > > I canonicalize tuple-like to `std::tuple`s of possibly wrapped > index_type; and not to stride<*, *, std::cw<1>>. > > The advantage is that the preconditions remain the same, because > tuples still exist, it's just that we don't encounter as much > variability but the kinds of objects remain the same. > > Generally, and as written in the paper, it does make sense to maybe > not canonicalize things like: > > - std::array<index_type, 2> > - std::tuple<std::constant_wrapper<index_type, *>, > std::constant_wrapper<index_type, *>> > Note that pair-like for the submdspan is representing [begin, end) range, while the strided_slice has [begin, offset, stride)? > > because those are very natural ways of specifying that kind of slice. > Therefore, even if there's a cost to canonicalization, every kind of > slice has a convenient canonical form (that users can provide to skip > canonicalization). > I do not think there should be differences between canonical forms of strided_slice and pair_like, they represent the same concept. And This should reduce the number of various concepts that we need to handle. Note that the __first, __last functions are now completely gone from the wording. > > Is it okay to send this variation as a v1? Naturally, you can then > say: nope, do the full P3663 please. > You can send that of course, but after rewriting the whole wording section, I think the previous specification was a bit of a dead end, so I think I wil answer that way anyway. > > > > > >> > >>>> > >>>> The idea I'm pursuing is to follow the pattern of casting slices to > >>>> "standard slices" immediately at the user-facing API layer, e.g. > >>>> > >>>> template<typename _Slices...> > >>>> constexpr auto > >>>> submdspan_extents(_Slices... __slices) > >>>> { > >>>> return > __submdspan_extents(__slice_cast(std::move(__slices))...); > >>>> } > >>>> > >> > >> > > > >
