Skip to content

Commit 2b32835

Browse files
authored
Merge 2023-06 LWG Motion 28
P2714R1 Bind front and back to NTTP callables
2 parents cd6517f + de75ee6 commit 2b32835

File tree

2 files changed

+103
-3
lines changed

2 files changed

+103
-3
lines changed

source/support.tex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,8 @@
576576
#define @\defnlibxname{cpp_lib_atomic_value_initialization}@ 201911L // freestanding, also in \libheader{atomic}, \libheader{memory}
577577
#define @\defnlibxname{cpp_lib_atomic_wait}@ 201907L // freestanding, also in \libheader{atomic}
578578
#define @\defnlibxname{cpp_lib_barrier}@ 202302L // also in \libheader{barrier}
579-
#define @\defnlibxname{cpp_lib_bind_back}@ 202202L // freestanding, also in \libheader{functional}
580-
#define @\defnlibxname{cpp_lib_bind_front}@ 201907L // freestanding, also in \libheader{functional}
579+
#define @\defnlibxname{cpp_lib_bind_back}@ 202306L // freestanding, also in \libheader{functional}
580+
#define @\defnlibxname{cpp_lib_bind_front}@ 202306L // freestanding, also in \libheader{functional}
581581
#define @\defnlibxname{cpp_lib_bit_cast}@ 201806L // freestanding, also in \libheader{bit}
582582
#define @\defnlibxname{cpp_lib_bitops}@ 201907L // freestanding, also in \libheader{bit}
583583
#define @\defnlibxname{cpp_lib_bitset}@ 202306L // also in \libheader{bitset}
@@ -704,7 +704,7 @@
704704
#define @\defnlibxname{cpp_lib_nonmember_container_access}@ 201411L
705705
// freestanding, also in \libheader{array}, \libheader{deque}, \libheader{forward_list}, \libheader{iterator}, \libheader{list}, \libheader{map}, \libheader{regex}, \libheader{set},
706706
// \libheader{string}, \libheader{unordered_map}, \libheader{unordered_set}, \libheader{vector}
707-
#define @\defnlibxname{cpp_lib_not_fn}@ 201603L // freestanding, also in \libheader{functional}
707+
#define @\defnlibxname{cpp_lib_not_fn}@ 202306L // freestanding, also in \libheader{functional}
708708
#define @\defnlibxname{cpp_lib_null_iterators}@ 201304L // freestanding, also in \libheader{iterator}
709709
#define @\defnlibxname{cpp_lib_optional}@ 202110L // also in \libheader{optional}
710710
#define @\defnlibxname{cpp_lib_out_ptr}@ 202106L // also in \libheader{memory}

source/utilities.tex

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10594,12 +10594,17 @@
1059410594

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

1059810599
// \ref{func.bind.partial}, function templates \tcode{bind_front} and \tcode{bind_back}
1059910600
template<class F, class... Args>
1060010601
constexpr @\unspec@ bind_front(F&&, Args&&...); // freestanding
10602+
template<auto f, class... Args>
10603+
constexpr @\unspec@ bind_front(Args&&...); // freestanding
1060110604
template<class F, class... Args>
1060210605
constexpr @\unspec@ bind_back(F&&, Args&&...); // freestanding
10606+
template<auto f, class... Args>
10607+
constexpr @\unspec@ bind_back(Args&&...); // freestanding
1060310608

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

12311+
\indexlibraryglobal{not_fn}%
12312+
\begin{itemdecl}
12313+
template<auto f> constexpr @\unspec@ not_fn() noexcept;
12314+
\end{itemdecl}
12315+
12316+
\begin{itemdescr}
12317+
\pnum
12318+
In the text that follows:
12319+
\begin{itemize}
12320+
\item
12321+
\tcode{F} is the type of \tcode{f},
12322+
\item
12323+
\tcode{g} is a value of the result of a \tcode{not_fn} invocation,
12324+
\item
12325+
\tcode{call_args} is an argument pack
12326+
used in a function call expression\iref{expr.call} of \tcode{g}.
12327+
\end{itemize}
12328+
12329+
\pnum
12330+
\mandates
12331+
If \tcode{is_pointer_v<F> || is_member_pointer_v<F>} is \tcode{true},
12332+
then \tcode{f != nullptr} is \tcode{true}.
12333+
12334+
\pnum
12335+
\returns
12336+
A perfect forwarding call wrapper\iref{func.require} \tcode{g} that
12337+
does not have state entities, and
12338+
has the call pattern \tcode{!invoke(f, call_args...)}.
12339+
\end{itemdescr}
12340+
1230612341
\rSec2[func.bind.partial]{Function templates \tcode{bind_front} and \tcode{bind_back}}
1230712342

1230812343
\indexlibraryglobal{bind_front}%
@@ -12371,6 +12406,71 @@
1237112406
the initialization of the state entities of \tcode{g}\iref{func.def}.
1237212407
\end{itemdescr}
1237312408

12409+
\indexlibraryglobal{bind_front}%
12410+
\indexlibraryglobal{bind_back}%
12411+
\begin{itemdecl}
12412+
template<auto f, class... Args>
12413+
constexpr @\unspec@ bind_front(Args&&... args);
12414+
template<auto f, class... Args>
12415+
constexpr @\unspec@ bind_back(Args&&... args);
12416+
\end{itemdecl}
12417+
12418+
\begin{itemdescr}
12419+
\pnum
12420+
Within this subclause:
12421+
\begin{itemize}
12422+
\item
12423+
\tcode{F} is the type of \tcode{f},
12424+
\item
12425+
\tcode{g} is a value of the result of
12426+
a \tcode{bind_front} or \tcode{bind_back} invocation,
12427+
\item
12428+
\tcode{BoundArgs} is a pack that denotes \tcode{decay_t<Args>...},
12429+
\item
12430+
\tcode{bound_args} is a pack of bound argument entities of
12431+
\tcode{g}\iref{func.def} of types \tcode{BoundArgs...},
12432+
direct-non-list-initialized with \tcode{std::forward<Args>(args)...},
12433+
respectively, and
12434+
\item
12435+
\tcode{call_args} is an argument pack used in
12436+
a function call expression\iref{expr.call} of \tcode{g}.
12437+
\end{itemize}
12438+
12439+
\pnum
12440+
\mandates
12441+
\begin{itemize}
12442+
\item
12443+
\tcode{(is_constructible_v<BoundArgs, Args> \&\& ...)} is \tcode{true}, and
12444+
\item
12445+
\tcode{(is_move_constructible_v<BoundArgs> \&\& ...)} is \tcode{true}, and
12446+
\item
12447+
if \tcode{is_pointer_v<F> || is_member_pointer_v<F>} is \tcode{true},
12448+
then \tcode{f != nullptr} is \tcode{true}.
12449+
\end{itemize}
12450+
12451+
\pnum
12452+
\expects
12453+
For each $\tcode{T}_i$ in \tcode{BoundArgs},
12454+
$\tcode{T}_i$ meets the \oldconcept{MoveConstructible} requirements.
12455+
12456+
\pnum
12457+
\returns
12458+
A perfect forwarding call wrapper\iref{func.require} \tcode{g} that
12459+
does not have a target object, and has the call pattern:
12460+
\begin{itemize}
12461+
\item
12462+
\tcode{invoke(f, bound_args..., call_args...)}
12463+
for a \tcode{bind_front} invocation, or
12464+
\item
12465+
\tcode{invoke(f, call_args..., bound_args...)}
12466+
for a \tcode{bind_back} invocation.
12467+
\end{itemize}
12468+
12469+
\pnum
12470+
throws
12471+
Any exception thrown by the initialization of \tcode{bound_args}.
12472+
\end{itemdescr}
12473+
1237412474
\rSec2[func.bind]{Function object binders}%
1237512475

1237612476
\rSec3[func.bind.general]{General}%

0 commit comments

Comments
 (0)