Skip to content
Open
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
54 changes: 23 additions & 31 deletions source/utilities.tex
Original file line number Diff line number Diff line change
Expand Up @@ -225,15 +225,6 @@
};
template<size_t I> constexpr in_place_index_t<I> in_place_index{};

// \tcode{constant_arg} argument tag%
\indexlibraryglobal{constant_arg_t}%
\indexlibraryglobal{constant_arg}
template<auto V>
struct constant_arg_t {
explicit constant_arg_t() = default;
};
template<auto V> constexpr constant_arg_t<V> constant_arg{};

// \ref{variant.monostate}, class \tcode{monostate}%
\indexlibraryglobal{monostate}
struct monostate;
Expand Down Expand Up @@ -15178,9 +15169,9 @@
// \ref{func.wrap.ref.ctor}, constructors and assignment operators
template<class F> function_ref(F*) noexcept;
template<class F> constexpr function_ref(F&&) noexcept;
template<auto f> constexpr function_ref(constant_arg_t<f>) noexcept;
template<auto f, class U> constexpr function_ref(constant_arg_t<f>, U&&) noexcept;
template<auto f, class T> constexpr function_ref(constant_arg_t<f>, @\cv{}@ T*) noexcept;
template<auto c, class F> constexpr function_ref(constant_wrapper<c, F>) noexcept;
template<auto c, class F, class U> constexpr function_ref(constant_wrapper<c, F>, U&&) noexcept;
template<auto c, class F, class T> constexpr function_ref(constant_wrapper<c, F>, @\cv{}@ T*) noexcept;

constexpr function_ref(const function_ref&) noexcept = default;
constexpr function_ref& operator=(const function_ref&) noexcept = default;
Expand Down Expand Up @@ -15311,21 +15302,26 @@

\indexlibraryctor{function_ref}%
\begin{itemdecl}
template<auto f> constexpr function_ref(constant_arg_t<f>) noexcept;
template<auto c, class F> constexpr function_ref(constant_wrapper<c, F> f) noexcept;
\end{itemdecl}

\begin{itemdescr}
\pnum
Let \tcode{F} be \tcode{decltype(f)}.

\pnum
\constraints
\tcode{\exposid{is-invocable-using}<const F\&>} is \tcode{true}.

\pnum
\mandates
\begin{itemize}
\item
If \tcode{is_pointer_v<F> || is_member_pointer_v<F>} is \tcode{true},
then \tcode{f != nullptr} is \tcode{true}.
then \tcode{f != nullptr} is \tcode{true}, and
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
then \tcode{f != nullptr} is \tcode{true}, and
then \tcode{f.value != nullptr} is \tcode{true}, and

\item
if \tcode{ArgTypes} is not an empty pack and
all types in \tcode{remove_cvref_t<ArgTypes>...} satisfy \exposconcept{const-expr-param}
then \tcode{constant_wrapper<\exposid{INVOKE}(f.value, remove_cvref_t<ArgTypes>::value...)>}
is not a valid type.
\end{itemize}

\pnum
\effects
Expand All @@ -15341,14 +15337,13 @@

\indexlibraryctor{function_ref}%
\begin{itemdecl}
template<auto f, class U>
constexpr function_ref(constant_arg_t<f>, U&& obj) noexcept;
template<auto c, class F, class U>
constexpr function_ref(constant_wrapper<c, F> f, U&& obj) noexcept;
\end{itemdecl}

\begin{itemdescr}
\pnum
Let \tcode{T} be \tcode{remove_reference_t<U>} and
\tcode{F} be \tcode{decltype(f)}.
Let \tcode{T} be \tcode{remove_reference_t<U>}.

\pnum
\constraints
Expand All @@ -15360,7 +15355,7 @@
\pnum
\mandates
If \tcode{is_pointer_v<F> || is_member_pointer_v<F>} is \tcode{true},
then \tcode{f != nullptr} is \tcode{true}.
then \tcode{f.value != nullptr} is \tcode{true}.

\pnum
\effects
Expand All @@ -15370,27 +15365,24 @@
such that
\tcode{\placeholder{thunk}(\exposid{bound-entity}, \placeholder{call-args}...)}
is expression-equivalent\iref{defns.expression.equivalent} to
\tcode{invoke_r<R>(f, static_cast<\cv{} T\&>(obj), \placeholder{call-args}...)}.
\tcode{invoke_r<R>(f.value, static_cast<\cv{} T\&>(obj), \placeholder{call-args}...)}.
\end{itemdescr}

\indexlibraryctor{function_ref}%
\begin{itemdecl}
template<auto f, class T>
constexpr function_ref(constant_arg_t<f>, @\cv{}@ T* obj) noexcept;
template<auto c, class F>
constexpr function_ref(constant_wrapper<c, F> f, @\cv{}@ T* obj) noexcept;
\end{itemdecl}

\begin{itemdescr}
\pnum
Let \tcode{F} be \tcode{decltype(f)}.

\pnum
\constraints
\tcode{\exposid{is-invocable-using}<const F\&, \cv{} T*>} is \tcode{true}.

\pnum
\mandates
If \tcode{is_pointer_v<F> || is_member_pointer_v<F>} is \tcode{true},
then \tcode{f != nullptr} is \tcode{true}.
then \tcode{f.value != nullptr} is \tcode{true}.

\pnum
\expects
Expand All @@ -15405,7 +15397,7 @@
such that
\tcode{\placeholder{thunk}(\exposid{bound-entity}, \placeholder{call-args}...)}
is expression-equivalent\iref{defns.expression.equivalent} to
\tcode{invoke_r<R>(f, obj, \placeholder{call-args}...)}.
\tcode{invoke_r<R>(f.value, obj, \placeholder{call-args}...)}.
\end{itemdescr}

\indexlibrarymember{operator=}{function_ref}%
Expand All @@ -15419,7 +15411,7 @@
\begin{itemize}
\item \tcode{T} is not the same type as \tcode{function_ref},
\item \tcode{is_pointer_v<T>} is \tcode{false}, and
\item \tcode{T} is not a specialization of \tcode{constant_arg_t}.
\item \tcode{T} is not a specialization of \tcode{constant_wrapper}.
\end{itemize}
\end{itemdescr}

Expand Down
Loading