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
78 changes: 35 additions & 43 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,11 @@
// \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 All @@ -15200,10 +15193,10 @@
// \ref{func.wrap.ref.deduct}, deduction guides
template<class F>
function_ref(F*) -> function_ref<F>;
template<auto f>
function_ref(constant_arg_t<f>) -> function_ref<@\seebelow@>;
template<auto f, class T>
function_ref(constant_arg_t<f>, T&&) -> function_ref<@\seebelow@>;
template<auto c, class F0>
function_ref(constant_wrapper<c, F0>) -> function_ref<@\seebelow@>;
template<auto c, class F, class T>
function_ref(constant_wrapper<c, F>, T&&) -> function_ref<@\seebelow@>;
}
\end{codeblock}

Expand Down Expand Up @@ -15311,21 +15304,27 @@

\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.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{constexpr-param} then
\tcode{constant_wrapper<\placeholdernc{INVOKE}(f.value, remove_cvref_t<ArgTypes>::\newline value...)>}
is not a valid type.
\end{itemize}

\pnum
\effects
Expand All @@ -15341,14 +15340,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 +15358,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 +15368,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 +15400,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 +15414,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 Expand Up @@ -15451,13 +15446,13 @@
\end{itemdescr}

\begin{itemdecl}
template<auto f>
function_ref(constant_arg_t<f>) -> function_ref<@\seebelow@>;
template<auto c, class F0>
function_ref(constant_wrapper<c, F0>) -> function_ref<@\seebelow@>;
\end{itemdecl}

\begin{itemdescr}
\pnum
Let \tcode{F} be \tcode{remove_pointer_t<decltype(f)>}.
Let \tcode{F} be \tcode{remove_pointer_t<F0>}.

\pnum
\constraints
Expand All @@ -15469,14 +15464,11 @@
\end{itemdescr}

\begin{itemdecl}
template<auto f, class T>
function_ref(constant_arg_t<f>, T&&) -> function_ref<@\seebelow@>;
template<auto c, class F, class T>
function_ref(constant_wrapper<c, F>, T&&) -> function_ref<@\seebelow@>;
\end{itemdecl}

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

\pnum
\constraints
%FIXME: R and E should be defined outside of these constraints.
Expand Down
Loading