On Thu, 29 May 2025 at 10:31, Jonathan Wakely <jwak...@redhat.com> wrote: > > On Mon, 26 May 2025 at 15:21, Luc Grosheintz <luc.groshei...@gmail.com> wrote: > > > > [mdspan.layout.left.cons] of N4950 states that this ctor is not > > noexcept. Since, all other ctors of layout_left, layout_right or > > layout_stride are noexcept, the choice was made, based on > > [res.on.exception.handling], to make this ctor noexcept. > > > > Two other major implementations of the STL make the same choice. > > "standard library implementations" not "implementations of the STL", > since mdspan is not part of the "STL" designed by Stepanov. > > > > > > libstdc++-v3/ChangeLog: > > > > * include/std/mdspan: Strengthen the exception > > guarantees of layout_left::mapping(layout_stride::mapping). > > * testsuite/23_containers/mdspan/layouts/ctors.cc: > > Simplify tests to reflect the change. > > > > Signed-off-by: Luc Grosheintz <luc.groshei...@gmail.com> > > --- > > libstdc++-v3/include/std/mdspan | 6 +++- > > .../23_containers/mdspan/layouts/ctors.cc | 33 ++++++++----------- > > 2 files changed, 19 insertions(+), 20 deletions(-) > > > > diff --git a/libstdc++-v3/include/std/mdspan > > b/libstdc++-v3/include/std/mdspan > > index 33ad5070a37..2a7f0452cd7 100644 > > --- a/libstdc++-v3/include/std/mdspan > > +++ b/libstdc++-v3/include/std/mdspan > > @@ -561,10 +561,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > > : mapping(__other.extents(), __mdspan::__internal_ctor{}) > > { } > > > > + // [mdspan.layout.left.cons] of N4950 states that this ctor is not > > + // noexcept. Since, all other ctors of layout_left, layout_right or > > + // layout_stride are noexcept, the choice was made, based on > > + // [res.on.exception.handling], to make this ctor noexcept. > > The comment seems a bit verbose, if we wrote four lines every time we > strengthen a noexcept-specifier based on [res.on.exception.handling] > we'd have no room left for code ;-) > > I think the git commit message already contains this information, so > if anybody is curious why we made it noexcept they can 'git blame' and > find the rationale there. Or to be explicit, a single line saying "// > noexcept for consistency with other layouts" seems good enough. > > I like how MSVC STL does this, which is to mark EVERY strengthened > noexcept with: > /* strengthened */ > > I can make these changes locally and push the patch, thanks.
Actually Tomasz reminded me that there are still review comments on the rest of the patch series, so please just amend this commit for the next time you send updates to the patch series. i.e. replace "STL" in the commit message and change the four lines of comments to just one line.