From de75ee6130ce65ee60794155c716efb803facb99 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Thu, 22 Jun 2023 12:01:11 -0700 Subject: [PATCH] P2714R1 Bind front and back to NTTP callables --- source/support.tex | 6 +-- source/utilities.tex | 100 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+), 3 deletions(-) diff --git a/source/support.tex b/source/support.tex index 51c24ba8ec..01c4f4649c 100644 --- a/source/support.tex +++ b/source/support.tex @@ -576,8 +576,8 @@ #define @\defnlibxname{cpp_lib_atomic_value_initialization}@ 201911L // freestanding, also in \libheader{atomic}, \libheader{memory} #define @\defnlibxname{cpp_lib_atomic_wait}@ 201907L // freestanding, also in \libheader{atomic} #define @\defnlibxname{cpp_lib_barrier}@ 202302L // also in \libheader{barrier} -#define @\defnlibxname{cpp_lib_bind_back}@ 202202L // freestanding, also in \libheader{functional} -#define @\defnlibxname{cpp_lib_bind_front}@ 201907L // freestanding, also in \libheader{functional} +#define @\defnlibxname{cpp_lib_bind_back}@ 202306L // freestanding, also in \libheader{functional} +#define @\defnlibxname{cpp_lib_bind_front}@ 202306L // freestanding, also in \libheader{functional} #define @\defnlibxname{cpp_lib_bit_cast}@ 201806L // freestanding, also in \libheader{bit} #define @\defnlibxname{cpp_lib_bitops}@ 201907L // freestanding, also in \libheader{bit} #define @\defnlibxname{cpp_lib_bitset}@ 202306L // also in \libheader{bitset} @@ -704,7 +704,7 @@ #define @\defnlibxname{cpp_lib_nonmember_container_access}@ 201411L // freestanding, also in \libheader{array}, \libheader{deque}, \libheader{forward_list}, \libheader{iterator}, \libheader{list}, \libheader{map}, \libheader{regex}, \libheader{set}, // \libheader{string}, \libheader{unordered_map}, \libheader{unordered_set}, \libheader{vector} -#define @\defnlibxname{cpp_lib_not_fn}@ 201603L // freestanding, also in \libheader{functional} +#define @\defnlibxname{cpp_lib_not_fn}@ 202306L // freestanding, also in \libheader{functional} #define @\defnlibxname{cpp_lib_null_iterators}@ 201304L // freestanding, also in \libheader{iterator} #define @\defnlibxname{cpp_lib_optional}@ 202110L // also in \libheader{optional} #define @\defnlibxname{cpp_lib_out_ptr}@ 202106L // also in \libheader{memory} diff --git a/source/utilities.tex b/source/utilities.tex index 6c81969930..663575d18a 100644 --- a/source/utilities.tex +++ b/source/utilities.tex @@ -10594,12 +10594,17 @@ // \ref{func.not.fn}, function template \tcode{not_fn} template constexpr @\unspec@ not_fn(F&& f); // freestanding + template constexpr @\unspec@ not_fn() noexcept; // freestanding // \ref{func.bind.partial}, function templates \tcode{bind_front} and \tcode{bind_back} template constexpr @\unspec@ bind_front(F&&, Args&&...); // freestanding + template + constexpr @\unspec@ bind_front(Args&&...); // freestanding template constexpr @\unspec@ bind_back(F&&, Args&&...); // freestanding + template + constexpr @\unspec@ bind_back(Args&&...); // freestanding // \ref{func.bind}, bind template struct is_bind_expression; // freestanding @@ -12303,6 +12308,36 @@ Any exception thrown by the initialization of \tcode{fd}. \end{itemdescr} +\indexlibraryglobal{not_fn}% +\begin{itemdecl} +template constexpr @\unspec@ not_fn() noexcept; +\end{itemdecl} + +\begin{itemdescr} +\pnum +In the text that follows: +\begin{itemize} +\item +\tcode{F} is the type of \tcode{f}, +\item +\tcode{g} is a value of the result of a \tcode{not_fn} invocation, +\item +\tcode{call_args} is an argument pack +used in a function call expression\iref{expr.call} of \tcode{g}. +\end{itemize} + +\pnum +\mandates +If \tcode{is_pointer_v || is_member_pointer_v} is \tcode{true}, +then \tcode{f != nullptr} is \tcode{true}. + +\pnum +\returns +A perfect forwarding call wrapper\iref{func.require} \tcode{g} that +does not have state entities, and +has the call pattern \tcode{!invoke(f, call_args...)}. +\end{itemdescr} + \rSec2[func.bind.partial]{Function templates \tcode{bind_front} and \tcode{bind_back}} \indexlibraryglobal{bind_front}% @@ -12371,6 +12406,71 @@ the initialization of the state entities of \tcode{g}\iref{func.def}. \end{itemdescr} +\indexlibraryglobal{bind_front}% +\indexlibraryglobal{bind_back}% +\begin{itemdecl} +template + constexpr @\unspec@ bind_front(Args&&... args); +template + constexpr @\unspec@ bind_back(Args&&... args); +\end{itemdecl} + +\begin{itemdescr} +\pnum +Within this subclause: +\begin{itemize} +\item +\tcode{F} is the type of \tcode{f}, +\item +\tcode{g} is a value of the result of +a \tcode{bind_front} or \tcode{bind_back} invocation, +\item +\tcode{BoundArgs} is a pack that denotes \tcode{decay_t...}, +\item +\tcode{bound_args} is a pack of bound argument entities of +\tcode{g}\iref{func.def} of types \tcode{BoundArgs...}, +direct-non-list-initialized with \tcode{std::forward(args)...}, +respectively, and +\item +\tcode{call_args} is an argument pack used in +a function call expression\iref{expr.call} of \tcode{g}. +\end{itemize} + +\pnum +\mandates +\begin{itemize} +\item +\tcode{(is_constructible_v \&\& ...)} is \tcode{true}, and +\item +\tcode{(is_move_constructible_v \&\& ...)} is \tcode{true}, and +\item +if \tcode{is_pointer_v || is_member_pointer_v} is \tcode{true}, +then \tcode{f != nullptr} is \tcode{true}. +\end{itemize} + +\pnum +\expects +For each $\tcode{T}_i$ in \tcode{BoundArgs}, +$\tcode{T}_i$ meets the \oldconcept{MoveConstructible} requirements. + +\pnum +\returns +A perfect forwarding call wrapper\iref{func.require} \tcode{g} that +does not have a target object, and has the call pattern: +\begin{itemize} +\item +\tcode{invoke(f, bound_args..., call_args...)} +for a \tcode{bind_front} invocation, or +\item +\tcode{invoke(f, call_args..., bound_args...)} +for a \tcode{bind_back} invocation. +\end{itemize} + +\pnum +throws +Any exception thrown by the initialization of \tcode{bound_args}. +\end{itemdescr} + \rSec2[func.bind]{Function object binders}% \rSec3[func.bind.general]{General}%