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 from e507db3 to d21204a Compare November 17, 2025 08: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.
@AlisdairM AlisdairM force-pushed the p3016r6_inconsistent_begin_end branch 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.

\end{itemdescr}

\rSec2[valarray.range]{\tcode{valarray} range access}
\rSec2[valarray.range]{range access}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
\rSec2[valarray.range]{range access}
\rSec2[valarray.range]{Range access}

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.

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.

Comment on lines +4690 to 4694
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.

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

Comment on lines +7414 to +7415
template<class C> constexpr auto crbegin(const C& c) noexcept(noexcept(c.crbegin()))
-> decltype(std::rbegin(c));
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
template<class C> constexpr auto crbegin(const C& c) noexcept(noexcept(c.crbegin()))
-> decltype(std::rbegin(c));
template<class C> constexpr auto crbegin(const C& c) noexcept(noexcept(std::rbegin(c)))
-> decltype(std::rbegin(c));

Same mistake of using the member functions instead of the std:: variant in a few other places.

\indexlibrary{\idxcode{ssize(C\& c)}}%
\begin{itemdecl}
template<class C> constexpr auto ssize(const C& c)
template<class C> constexpr auto ssize(const C& c) noexcept(noexcept(c.ssize()))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
template<class C> constexpr auto ssize(const C& c) noexcept(noexcept(c.ssize()))
template<class C> constexpr auto ssize(const C& c) noexcept(noexcept(c.size()))

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

4 participants