Skip to content

[LWG motion 28] P2714R1 Bind front and back to NTTP callables #6339

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

Merged
merged 1 commit into from
Jul 21, 2023
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
6 changes: 3 additions & 3 deletions source/support.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand Down
100 changes: 100 additions & 0 deletions source/utilities.tex
Original file line number Diff line number Diff line change
Expand Up @@ -10594,12 +10594,17 @@

// \ref{func.not.fn}, function template \tcode{not_fn}
template<class F> constexpr @\unspec@ not_fn(F&& f); // freestanding
template<auto f> constexpr @\unspec@ not_fn() noexcept; // freestanding

// \ref{func.bind.partial}, function templates \tcode{bind_front} and \tcode{bind_back}
template<class F, class... Args>
constexpr @\unspec@ bind_front(F&&, Args&&...); // freestanding
template<auto f, class... Args>
constexpr @\unspec@ bind_front(Args&&...); // freestanding
template<class F, class... Args>
constexpr @\unspec@ bind_back(F&&, Args&&...); // freestanding
template<auto f, class... Args>
constexpr @\unspec@ bind_back(Args&&...); // freestanding

// \ref{func.bind}, bind
template<class T> struct is_bind_expression; // freestanding
Expand Down Expand Up @@ -12303,6 +12308,36 @@
Any exception thrown by the initialization of \tcode{fd}.
\end{itemdescr}

\indexlibraryglobal{not_fn}%
\begin{itemdecl}
template<auto f> 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<F> || is_member_pointer_v<F>} 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}%
Expand Down Expand Up @@ -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<auto f, class... Args>
constexpr @\unspec@ bind_front(Args&&... args);
template<auto f, class... Args>
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<Args>...},
\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>(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<BoundArgs, Args> \&\& ...)} is \tcode{true}, and
\item
\tcode{(is_move_constructible_v<BoundArgs> \&\& ...)} is \tcode{true}, and
\item
if \tcode{is_pointer_v<F> || is_member_pointer_v<F>} 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}%
Expand Down