Skip to content

Conversation

@AlisdairM
Copy link
Contributor

@AlisdairM AlisdairM commented Nov 17, 2025

Fixes #8462

@AlisdairM AlisdairM force-pushed the p3016r6_inconsistent_begin_end branch 2 times, most recently from fda8120 to 09fe942 Compare November 17, 2025 08:27
@eisenwave eisenwave added this to the post-2025-11 milestone Nov 17, 2025
Copy link
Member

@eisenwave eisenwave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some discrepancies.

Especially make sure that the noexcept(noexcept(...)) contents are correct.

Comment on lines 581 to 582
#define @\defnlibxname{cpp_lib_apply}@ 202506L // freestanding, also in \libheader{tuple}, \libheader{type_traits}
#define @\defnlibxname{cpp_lib_apply}@ 202506L
// freestanding, also in \libheader{tuple}, \libheader{type_traits}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see this in the paper, so it should presumably done in a different PR because it's totally unrelated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This entry is merely reformatted. I think such change isn't necessary for CI (otherwise, CI should have been failing before) and should be dropped.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reformatting avoids splitting <type_- and traits> across two lines, which is an improvement. But it should be a separate commit.

Copy link
Contributor Author

@AlisdairM AlisdairM Nov 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have amended the original commit and cherry-picked everything else that followed.

Comment on lines 9179 to 9183
\indexlibrarymember{begin}{valarray}%
\indexlibrarymember{valarray}{begin}%
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old way was correct, the way it's described in our specification style guidelines.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Embarrassing -- that was my convention!

Comment on lines 9191 to 9195
\indexlibrarymember{end}{valarray}%
\indexlibrarymember{valarray}{end}%
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, the old style was correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still embarrassing -- that was my convention!

Comment on lines +4690 to 4693
constexpr const E* data() const noexcept;
constexpr size_t size() const noexcept; // number of elements
constexpr bool empty() const noexcept;
constexpr const E* begin() const noexcept; // first element
constexpr const E* end() const noexcept; // one past the last element
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While the paper doesn't propose any comments in this area, it's inconsistent to have "tutorial comments" on only some of these functions within this block. Maybe a follow-up commit (possibly on a separate PR) could just remove all of those.

I don't think we need code comments like // number of elements telling us that size() returns the number of elements.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with removing them, but it should definitely be a separate PR not as part of this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking: our preferred resolution is the let the inconsistent lack of comments stand applying the paper, but once it has landed (or before with a rebase?), file a follow-up PR to remove the three one-line comments above?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, apply the paper as-is in this area.

Comment on lines +468 to +475
template<class C> constexpr auto
begin(C& c) noexcept(noexcept(c.begin())) -> decltype(c.begin()); // freestanding
template<class C> constexpr auto
begin(const C& c) noexcept(noexcept(c.begin())) -> decltype(c.begin()); // freestanding
template<class C> constexpr auto
end(C& c) noexcept(noexcept(c.end())) -> decltype(c.end()); // freestanding
template<class C> constexpr auto
end(const C& c) noexcept(noexcept(c.end())) -> decltype(c.end()); // freestanding
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, I liked the style in the paper better,
which is

  template<class C> constexpr auto begin(C& c)
    noexcept(noexcept(c.begin())) -> decltype(c.begin());

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually break after the template-head, and then maybe also break later in the declaration. But I think the <iterator> synopsis is unusual (unique even?) in doing:

template<class C> constexpr auto

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i.e. I think it would be move conventional to do:

template<class C>
  constexpr auto begin(C& c) noexcept(...) -> decltype(...);     // freestanding

and if that doesn't fit, then something like:

template<class C>
  constexpr auto begin(C& c) noexcept(...)
    -> decltype(...);                                            // freestanding

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the more conventional style, but deliberately followed the example of breaking already used throughout this clause. Should I apply our more usual breaking pattern to this header as whole, as a distinct commit?

AlisdairM and others added 6 commits November 22, 2025 13:03
It is tricky to properly line-break the list of additional headers
that contain the range functions, and that list is growing quite
large to be displayed as a list in a single sentence.  Prefer to
render the list as a table instead.

Retained the cross-references to the header synopses from the
original text, but they look odd in the table format.
Co-authored-by: Jan Schultke <me@eisenwave.net>
Co-authored-by: Jan Schultke <me@eisenwave.net>
Co-authored-by: Jan Schultke <me@eisenwave.net>
@AlisdairM AlisdairM force-pushed the p3016r6_inconsistent_begin_end branch from 0834de9 to fcda795 Compare November 22, 2025 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[2025-11 LWG Motion 3] P3016R6 Resolve inconsistencies in begin/end for valarray and braced initializer lists

5 participants