Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

P3050R2 Fix C++26 by optimizing linalg::conjugated for noncomplex value types #7493

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions source/numerics.tex
Original file line number Diff line number Diff line change
Expand Up @@ -12808,21 +12808,40 @@
\begin{itemdescr}
\pnum
Let \tcode{A} be
\begin{itemize}
\item
\tcode{remove_cvref_t<decltype(a.accessor().nested_accessor())>}
if \tcode{Accessor} is a specialization of \tcode{conjugated_accessor}, and
otherwise \tcode{conjugated_accessor<Accessor>}.
if \tcode{Accessor} is a specialization of \tcode{conjugated_accessor}; otherwise,
\item
\tcode{Accessor} if \tcode{remove_cvref_t<ElementType>} is an arithmetic type; otherwise,
\item
\tcode{Accessor} if the expression \tcode{conj(E)} is not valid for any subexpression \tcode{E}
whose type \tcode{T} is expression-equivalent to \tcode{remove_cvref_t<ElementType>}
Comment on lines +12818 to +12819
Copy link
Member

@jwakely jwakely Dec 17, 2024

Choose a reason for hiding this comment

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

A type cannot be expression-equivalent. I'm not sure what the paper's intent actually was here, E is simply not defined well. Should it really be an rvalue, as this wording kinda implies? That doesn't seem right to me. I think we need input from @mhoemmen or LWG.

This also introduces two types T, the one that is the type of E and the template parameter of the conj poison pill, which is a bit confusing, but that problem is already present throughout [linalg.helpers].

Suggested change
\tcode{Accessor} if the expression \tcode{conj(E)} is not valid for any subexpression \tcode{E}
whose type \tcode{T} is expression-equivalent to \tcode{remove_cvref_t<ElementType>}
\tcode{Accessor} if the expression \tcode{conj(E)} is not valid for any subexpression \tcode{E}
of a type similar to \tcode{remove_cvref_t<ElementType>}

Copy link
Member

Choose a reason for hiding this comment

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

I opened #7494 for the T reuse.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do let's follow up asap, but I'll merge the motion application as is for now.

Copy link
Member

Choose a reason for hiding this comment

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

@mhoemmen in case you missed this one (I think I spelled your username wrong at first and I don't think github resends emails after comments are edited)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jwakely Please see #7497!

Copy link
Contributor

Choose a reason for hiding this comment

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

@jwakely FYI, this issue refers to R2, but it was R3 that was approved by LWG on 2024-10-25. That might have wording differences.

with overload resolution performed in a context that includes the declaration
\tcode{template<class T> conj(const T\&) = delete;}; and otherwise,
\item
\tcode{conjugated_accessor<Accessor>}.
\end{itemize}

\pnum
\returns
\begin{itemize}
\item
If \tcode{Accessor} is a specialization of \tcode{conjugated_accessor},
The value
\begin{codeblock}
mdspan<typename A::element_type, Extents, Layout, A>(a.data_handle(), a.mapping(),
a.accessor().nested_accessor())
\end{codeblock}
if \tcode{Accessor} is a specialization of \tcode{conjugated_accessor}; otherwise,
\item
otherwise,
\tcode{a} if \tcode{remove_cvref_t<ElementType>} is an arithmetic type; otherwise,
\item
\tcode{a} if the expression \tcode{conj(E)} is not valid for any subexpression \tcode{E}
whose type \tcode{T} is expression-equivalent to \tcode{remove_cvref_t<ElementType>}
with overload resolution performed in a context that includes the declaration
\tcode{template<class T> conj(const T\&) = delete;}; and otherwise,
\item
the value
\begin{codeblock}
mdspan<typename A::element_type, Extents, Layout, A>(a.data_handle(), a.mapping(),
conjugated_accessor(a.accessor()))
Expand Down
2 changes: 1 addition & 1 deletion source/support.tex
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@
#define @\defnlibxname{cpp_lib_jthread}@ 201911L // also in \libheader{stop_token}, \libheader{thread}
#define @\defnlibxname{cpp_lib_latch}@ 201907L // also in \libheader{latch}
#define @\defnlibxname{cpp_lib_launder}@ 201606L // freestanding, also in \libheader{new}
#define @\defnlibxname{cpp_lib_linalg}@ 202411L // also in \libheader{linalg}
#define @\defnlibxname{cpp_lib_linalg}@ 202412L // also in \libheader{linalg}
#define @\defnlibxname{cpp_lib_list_remove_return_type}@ 201806L // also in \libheader{forward_list}, \libheader{list}
#define @\defnlibxname{cpp_lib_logical_traits}@ 201510L // freestanding, also in \libheader{type_traits}
#define @\defnlibxname{cpp_lib_make_from_tuple}@ 201606L // freestanding, also in \libheader{tuple}
Expand Down
Loading