Skip to content
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
28 changes: 15 additions & 13 deletions source/algorithms.tex
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,13 @@
whenever an algorithm expects a function object\iref{function.objects} that,
when applied to the result of dereferencing the corresponding iterator,
returns a value testable as \tcode{true}.
In other words,
if an algorithm takes \tcode{Predicate pred} as its argument and
If an algorithm takes \tcode{Predicate pred} as its argument and
\tcode{first} as its iterator argument with value type \tcode{T},
it should work correctly in the construct
\tcode{pred(*first)} contextually converted to \tcode{bool}\iref{conv}.
the expression \tcode{pred(*first)} shall be well-formed and
the type \tcode{decltype(pred(*first))} shall model
\exposconcept{boolean-testable}\iref{concept.booleantestable}.
The function object \tcode{pred} shall not apply any non-constant function
through the dereferenced iterator.
through its argument.
Given a glvalue \tcode{u} of type (possibly \keyword{const}) \tcode{T}
that designates the same object as \tcode{*first},
\tcode{pred(u)} shall be a valid expression
Expand All @@ -170,19 +170,21 @@
to dereferencing an iterator and type \tcode{T}
when \tcode{T} is part of the signature,
returns a value testable as \tcode{true}.
In other words,
if an algorithm takes \tcode{BinaryPredicate binary_pred} as its argument and
If an algorithm takes \tcode{BinaryPredicate binary_pred} as its argument and
\tcode{first1} and \tcode{first2} as its iterator arguments
with respective value types \tcode{T1} and \tcode{T2},
it should work correctly in the construct
\tcode{binary_pred(*first1, *first2)} contextually converted to \tcode{bool}\iref{conv}.
the expression \tcode{binary_pred(*first1, *first2)} shall be well-formed and
the type \tcode{decltype(binary_pred(*first1, *first2))} shall model
\exposconcept{boolean-testable}.
Unless otherwise specified,
\tcode{BinaryPredicate} always takes the first iterator's \tcode{value_type}
as its first argument, that is, in those cases when \tcode{T value}
is part of the signature, it should work correctly in the construct
\tcode{binary_pred(*first1, value)} contextually converted to \tcode{bool}\iref{conv}.
is part of the signature,
the expression \tcode{binary_pred(*first1, value)} shall be well-formed and
the type \tcode{decltype(binary_pred(*first1, value))} shall model
\exposconcept{boolean-testable}.
\tcode{binary_pred} shall not apply any non-constant function
through the dereferenced iterators.
through any of its arguments.
Given a glvalue \tcode{u} of type (possibly \keyword{const}) \tcode{T1}
that designates the same object as \tcode{*first1}, and
a glvalue \tcode{v} of type (possibly \keyword{const}) \tcode{T2}
Expand Down Expand Up @@ -6569,7 +6571,7 @@
named \tcode{BinaryPredicate}~\iref{algorithms.requirements}.
The return value of the function call operation
applied to an object of type \tcode{Compare},
when contextually converted to \tcode{bool}\iref{conv},
when converted to \tcode{bool},
yields \tcode{true}
if the first argument of the call is less than the second, and
\tcode{false} otherwise.
Expand Down
4 changes: 2 additions & 2 deletions source/containers.tex
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@

\pnum
\result
Convertible to \tcode{bool}.
\tcode{bool}.

\pnum
\returns
Expand Down Expand Up @@ -536,7 +536,7 @@
\begin{itemdescr}
\pnum
\result
Convertible to \tcode{bool}.
\tcode{bool}.

\pnum
\returns
Expand Down
14 changes: 5 additions & 9 deletions source/iterators.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2095,7 +2095,7 @@
& & \chdr{semantics} & \rhdr{pre-/post-condition} \\ \capsep
\endhead
\tcode{a != b} &
contextually convertible to \tcode{bool} &
\tcode{decltype(a != b)} models \exposconceptx{boolean-test\-able}{boolean-testable} &
\tcode{!(a == b)} &
\expects \orange{a}{b} is in the domain of \tcode{==}. \\ \rowsep

Expand Down Expand Up @@ -2383,25 +2383,21 @@
\tcode{*(a + n)} & \\ \rowsep

\tcode{a < b} &
contextually
convertible to \tcode{bool} &
\tcode{decltype(a < b)} models \exposconceptx{boolean-test\-able}{boolean-testable} &
\effects Equivalent to: \tcode{return b - a > 0;} &
\tcode{<} is a total ordering relation \\ \rowsep

\tcode{a > b} &
contextually
convertible to \tcode{bool} &
\tcode{decltype(a > b)} models \exposconceptx{boolean-test\-able}{boolean-testable} &
\tcode{b < a} &
\tcode{>} is a total ordering relation opposite to \tcode{<}. \\ \rowsep

\tcode{a >= b} &
contextually
convertible to \tcode{bool} &
\tcode{decltype(a >= b)} models \exposconceptx{boolean-test\-able}{boolean-testable} &
\tcode{!(a < b)} & \\ \rowsep

\tcode{a <= b} &
contextually
convertible to \tcode{bool}. &
\tcode{decltype(a <= b)} models \exposconceptx{boolean-test\-able}{boolean-testable} &
\tcode{!(a > b)} & \\
\end{libreqtab4b}

Expand Down
12 changes: 6 additions & 6 deletions source/lib-intro.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1622,7 +1622,7 @@
\topline
\hdstyle{Expression} & \hdstyle{Return type} & \rhdr{Requirement} \\ \capsep
\tcode{a == b} &
convertible to \tcode{bool} &
\tcode{decltype(a == b)} models \exposconceptx{boolean-testa\-ble}{boolean-testable} &
\tcode{==} is an equivalence relation,
that is, it has the following properties:
\begin{itemize}
Expand All @@ -1640,7 +1640,7 @@
\topline
\hdstyle{Expression} & \hdstyle{Return type} & \hdstyle{Requirement} \\ \capsep
\tcode{a < b} &
convertible to \tcode{bool} &
\tcode{decltype(a < b)} models \exposconceptx{boolean-testa\-ble}{boolean-testable} &
\tcode{<} is a strict weak ordering relation\iref{alg.sorting} \\
\end{oldconcepttable}

Expand Down Expand Up @@ -1863,7 +1863,7 @@
a value of type (possibly \keyword{const}) \tcode{std::nullptr_t}.

\begin{oldconcepttable}{NullablePointer}{}{cpp17.nullablepointer}
{lll}
{lx{2in}l}
\topline
\lhdr{Expression} & \chdr{Return type} & \rhdr{Operational semantics} \\ \capsep
\tcode{P u(np);}\br &
Expand All @@ -1882,17 +1882,17 @@
\ensures \tcode{t == nullptr} \\ \rowsep

\tcode{a != b} &
contextually convertible to \tcode{bool} &
\tcode{decltype(a != b)} models \exposconcept{boolean-testable} &
\tcode{!(a == b)} \\ \rowsep

\tcode{a == np} &
contextually convertible to \tcode{bool} &
\tcode{decltype(a == np)} and \tcode{decltype(np == a)} each model \exposconcept{boolean-testable} &
\tcode{a == P()} \\
\tcode{np == a} &
&
\\ \rowsep
\tcode{a != np} &
contextually convertible to \tcode{bool} &
\tcode{decltype(a != np)} and \tcode{decltype(np != a)} each model \exposconcept{boolean-testable} &
\tcode{!(a == np)} \\
\tcode{np != a} &
&
Expand Down
12 changes: 9 additions & 3 deletions source/support.tex
Original file line number Diff line number Diff line change
Expand Up @@ -5047,7 +5047,9 @@
Otherwise, \tcode{strong_order(E, F)} if it is a well-formed expression.
\item
Otherwise, if the expressions \tcode{E == F} and \tcode{E < F}
are both well-formed and convertible to \tcode{bool},
are both well-formed and
each of \tcode{decltype(E == F)} and \tcode{decltype(E < F)} models
\exposconcept{boolean-testable},
\begin{codeblock}
E == F ? strong_ordering::equal :
E < F ? strong_ordering::less :
Expand Down Expand Up @@ -5079,7 +5081,9 @@
Otherwise, \tcode{weak_order(E, F)} if it is a well-formed expression.
\item
Otherwise, if the expressions \tcode{E == F} and \tcode{E < F}
are both well-formed and convertible to \tcode{bool},
are both well-formed and
each of \tcode{decltype(E == F)} and \tcode{decltype(E < F)} models
\exposconcept{boolean-testable},
\begin{codeblock}
E == F ? weak_ordering::equivalent :
E < F ? weak_ordering::less :
Expand Down Expand Up @@ -5112,7 +5116,9 @@
\item
Otherwise, if the expressions
\tcode{E == F}, \tcode{E < F}, and \tcode{F < E}
are all well-formed and convertible to \tcode{bool},
are all well-formed and
each of \tcode{decltype(E == F)} and \tcode{decltype(E < F)} models
\exposconcept{boolean-testable},
\begin{codeblock}
E == F ? partial_ordering::equivalent :
E < F ? partial_ordering::less :
Expand Down
10 changes: 8 additions & 2 deletions source/threads.tex
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,14 @@
\pnum
Throughout this Clause, the names of template parameters are used to express type
requirements.
If a template parameter is named \tcode{Predicate}, \tcode{operator()} applied to
the template argument shall return a value that is convertible to \tcode{bool}.
\tcode{Predicate} is a function object type\iref{function.objects}.
Let \tcode{pred} denote an lvalue of type \tcode{Predicate}.
Then the expression \tcode{pred()} shall be well-formed and
the type \tcode{decltype(pred())} shall model
\exposconcept{boolean-testable}\iref{concept.booleantestable}.
The return value of \tcode{pred()}, converted to \tcode{bool},
yields \tcode{true} if the corresponding test condition is satisfied, and
\tcode{false} otherwise.
If a template parameter is named \tcode{Clock},
the corresponding template argument shall be a type \tcode{C}
that meets the \oldconcept{Clock} requirements\iref{time.clock.req};
Expand Down
13 changes: 11 additions & 2 deletions source/utilities.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1269,6 +1269,11 @@
\end{itemdecl}

\begin{itemdescr}
\pnum
\expects
Each of \tcode{decltype(x.first == y.first)} and
\tcode{decltype(x.second == y.second)} models \exposconcept{boolean-testable}.

\pnum
\returns
\tcode{x.first == y.first \&\& x.second == y.second}.
Expand Down Expand Up @@ -2907,11 +2912,15 @@
\mandates
For all \tcode{i},
where $0 \leq \tcode{i} < \tcode{sizeof...(TTypes)}$,
\tcode{get<i>(t) == get<i>(u)} is a valid expression
returning a type that is convertible to \tcode{bool}.
\tcode{get<i>(t) == get<i>(u)} is a valid expression.
\tcode{sizeof...(TTypes)} equals
\tcode{tuple_size_v<UTuple>}.

\pnum
\expects
For all \tcode{i}, \tcode{decltype(get<i>(t) == get<i>(u))} models
\exposconcept{boolean-testable}.

\pnum
\returns
\tcode{true} if \tcode{get<i>(t) == get<i>(u)} for all
Expand Down