Skip to content

Commit

Permalink
more review feedback, fixes #16, fixes #15, fixes #14, fixes #13, fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Niebler committed May 25, 2015
1 parent 99b2e75 commit 49c8620
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 80 deletions.
48 changes: 24 additions & 24 deletions algorithms.tex
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@
for_each(Rng& rng, Fun f, Proj proj = Proj{});

template<InputIterator I, Sentinel<I> S, class T, class Proj = identity>
requires IndirectRelation<equal_to<>, Projected<I, Proj>, const T *>
requires IndirectCallableRelation<equal_to<>, Projected<I, Proj>, const T *>
I find(I first, S last, const T& value, Proj proj = Proj{});

template<Input@\oldtxt{Iterable}\newtxt{Range}@ Rng, class T, class Proj = identity>
requires IndirectRelation<equal_to<>, Projected<IteratorType<Rng>, Proj>, const T *>
requires IndirectCallableRelation<equal_to<>, Projected<IteratorType<Rng>, Proj>, const T *>
IteratorType<Rng>
find(Rng& rng, const T& value, Proj proj = Proj{});

Expand Down Expand Up @@ -137,12 +137,12 @@
adjacent_find(Rng& rng, Pred pred = Pred{}, Proj proj = Proj{});

template<InputIterator I, Sentinel<I> S, class T, class Proj = identity>
requires IndirectRelation<equal_to<>, Projected<I, Proj>, const T *>
requires IndirectCallableRelation<equal_to<>, Projected<I, Proj>, const T *>
DifferenceType<I>
count(I first, S last, const T& value, Proj proj = Proj{});

template<Input@\oldtxt{Iterable}\newtxt{Range}@ Rng, class T, class Proj = identity>
requires IndirectRelation<equal_to<>, Projected<IteratorType<Rng>, Proj>, const T *>
requires IndirectCallableRelation<equal_to<>, Projected<IteratorType<Rng>, Proj>, const T *>
DifferenceType<IteratorType<Rng>>
count(Rng&& rng, const T& value, Proj proj = Proj{});

Expand Down Expand Up @@ -408,13 +408,13 @@

template<ForwardIterator I, Sentinel<I> S, class T1, Semiregular T2, class Proj = identity>
requires Writable<I, T2> &&
IndirectRelation<equal_to<>, Projected<I, Proj>, const T1 *>
IndirectCallableRelation<equal_to<>, Projected<I, Proj>, const T1 *>
I
replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = Proj{});

template<Forward@\oldtxt{Iterable}\newtxt{Range}@ Rng, class T1, Semiregular T2, class Proj = identity>
requires Writable<IteratorType<Rng>, T2> &&
IndirectRelation<equal_to<>, Projected<IteratorType<Rng>, Proj>, const T1 *>
IndirectCallableRelation<equal_to<>, Projected<IteratorType<Rng>, Proj>, const T1 *>
IteratorType<Rng>
replace(Rng& rng, const T1& old_value, const T2& new_value);

Expand All @@ -433,15 +433,15 @@
template<InputIterator I, Sentinel<I> S, class T1, Semiregular T2, WeakOutputIterator<T2> O,
class Proj = identity>
requires IndirectlyCopyable<I, O> &&
IndirectRelation<equal_to<>, Projected<I, Proj>, const T1 *>
IndirectCallableRelation<equal_to<>, Projected<I, Proj>, const T1 *>
pair<I, O>
replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value,
Proj proj = Proj{});

template<Input@\oldtxt{Iterable}\newtxt{Range}@ Rng, class T1, Semiregular T2, WeakOutputIterator<T2> O,
class Proj = identity>
requires IndirectlyCopyable<IteratorType<Rng>, O> &&
IndirectRelation<equal_to<>, Projected<IteratorType<Rng>, Proj>, const T1 *>
IndirectCallableRelation<equal_to<>, Projected<IteratorType<Rng>, Proj>, const T1 *>
pair<IteratorType<Rng>, O>
replace_copy(Rng& rng, O result, const T1& old_value, const T2& new_value,
Proj proj = Proj{});
Expand Down Expand Up @@ -486,12 +486,12 @@

template<ForwardIterator I, Sentinel<I> S, class T, class Proj = identity>
requires Permutable<I> &&
IndirectRelation<equal_to<>, Projected<I, Proj>, const T *>
IndirectCallableRelation<equal_to<>, Projected<I, Proj>, const T *>
I remove(I first, S last, const T& value, Proj proj = Proj{});

template<Forward@\oldtxt{Iterable}\newtxt{Range}@ Rng, class T, class Proj = identity>
requires Permutable<IteratorType<Rng>> &&
IndirectRelation<equal_to<>, Projected<IteratorType<Rng>, Proj>, const T *>
IndirectCallableRelation<equal_to<>, Projected<IteratorType<Rng>, Proj>, const T *>
IteratorType<Rng>
remove(Rng& rng, const T& value, Proj proj = Proj{});

Expand All @@ -509,12 +509,12 @@
template<InputIterator I, Sentinel<I> S, WeaklyIncrementable O, class T,
class Proj = identity>
requires IndirectlyCopyable<I, O> &&
IndirectRelation<equal_to<>, Projected<I, Proj>, const T *>
IndirectCallableRelation<equal_to<>, Projected<I, Proj>, const T *>
pair<I, O> remove_copy(I first, S last, O result, const T& value, Proj proj = Proj{});

template<Input@\oldtxt{Iterable}\newtxt{Range}@ Rng, WeaklyIncrementable O, class T, class Proj = identity>
requires IndirectlyCopyable<IteratorType<Rng>, O> &&
IndirectRelation<equal_to<>, Projected<IteratorType<Rng>, Proj>, const T *>
IndirectCallableRelation<equal_to<>, Projected<IteratorType<Rng>, Proj>, const T *>
pair<IteratorType<Rng>, O>
remove_copy(Rng& rng, O result, const T& value, Proj proj = Proj{});

Expand Down Expand Up @@ -1555,11 +1555,11 @@
\begin{addedblock}
\begin{itemdecl}
template<InputIterator I, Sentinel<I> S, class T, class Proj = identity>
requires IndirectRelation<equal_to<>, Projected<I, Proj>, const T *>
requires IndirectCallableRelation<equal_to<>, Projected<I, Proj>, const T *>
I find(I first, S last, const T& value, Proj proj = Proj{});

template<Input@\oldtxt{Iterable}\newtxt{Range}@ Rng, class T, class Proj = identity>
requires IndirectRelation<equal_to<>, Projected<IteratorType<Rng>, Proj>, const T *>
requires IndirectCallableRelation<equal_to<>, Projected<IteratorType<Rng>, Proj>, const T *>
IteratorType<Rng>
find(Rng& rng, const T& value, Proj proj = Proj{});

Expand Down Expand Up @@ -1807,12 +1807,12 @@
\begin{addedblock}
\begin{itemdecl}
template<InputIterator I, Sentinel<I> S, class T, class Proj = identity>
requires IndirectRelation<equal_to<>, Projected<I, Proj>, const T *>
requires IndirectCallableRelation<equal_to<>, Projected<I, Proj>, const T *>
DifferenceType<I>
count(I first, S last, const T& value, Proj proj = Proj{});

template<Input@\oldtxt{Iterable}\newtxt{Range}@ Rng, class T, class Proj = identity>
requires IndirectRelation<equal_to<>, Projected<IteratorType<Rng>, Proj>, const T *>
requires IndirectCallableRelation<equal_to<>, Projected<IteratorType<Rng>, Proj>, const T *>
DifferenceType<IteratorType<Rng>>
count(Rng&& rng, const T& value, Proj proj = Proj{});

Expand Down Expand Up @@ -2792,13 +2792,13 @@
\begin{itemdecl}
template<ForwardIterator I, Sentinel<I> S, class T1, Semiregular T2, class Proj = identity>
requires Writable<I, T2> &&
IndirectRelation<equal_to<>, Projected<I, Proj>, const T1 *>
IndirectCallableRelation<equal_to<>, Projected<I, Proj>, const T1 *>
I
replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = Proj{});

template<Forward@\oldtxt{Iterable}\newtxt{Range}@ Rng, class T1, Semiregular T2, class Proj = identity>
requires Writable<IteratorType<Rng>, T2> &&
IndirectRelation<equal_to<>, Projected<IteratorType<Rng>, Proj>, const T1 *>
IndirectCallableRelation<equal_to<>, Projected<IteratorType<Rng>, Proj>, const T1 *>
IteratorType<Rng>
replace(Rng& rng, const T1& old_value, const T2& new_value);

Expand Down Expand Up @@ -2870,15 +2870,15 @@
template<InputIterator I, Sentinel<I> S, class T1, Semiregular T2, WeakOutputIterator<T2> O,
class Proj = identity>
requires IndirectlyCopyable<I, O> &&
IndirectRelation<equal_to<>, Projected<I, Proj>, const T1 *>
IndirectCallableRelation<equal_to<>, Projected<I, Proj>, const T1 *>
pair<I, O>
replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value,
Proj proj = Proj{});

template<Input@\oldtxt{Iterable}\newtxt{Range}@ Rng, class T1, Semiregular T2, WeakOutputIterator<T2> O,
class Proj = identity>
requires IndirectlyCopyable<IteratorType<Rng>, O> &&
IndirectRelation<equal_to<>, Projected<IteratorType<Rng>, Proj>, const T1 *>
IndirectCallableRelation<equal_to<>, Projected<IteratorType<Rng>, Proj>, const T1 *>
pair<IteratorType<Rng>, O>
replace_copy(Rng& rng, O result, const T1& old_value, const T2& new_value,
Proj proj = Proj{});
Expand Down Expand Up @@ -3077,12 +3077,12 @@
\begin{itemdecl}
template<ForwardIterator I, Sentinel<I> S, class T, class Proj = identity>
requires Permutable<I> &&
IndirectRelation<equal_to<>, Projected<I, Proj>, const T *>
IndirectCallableRelation<equal_to<>, Projected<I, Proj>, const T *>
I remove(I first, S last, const T& value, Proj proj = Proj{});

template<Forward@\oldtxt{Iterable}\newtxt{Range}@ Rng, class T, class Proj = identity>
requires Permutable<IteratorType<Rng>> &&
IndirectRelation<equal_to<>, Projected<IteratorType<Rng>, Proj>, const T *>
IndirectCallableRelation<equal_to<>, Projected<IteratorType<Rng>, Proj>, const T *>
IteratorType<Rng>
remove(Rng& rng, const T& value, Proj proj = Proj{});

Expand Down Expand Up @@ -3158,12 +3158,12 @@
template<InputIterator I, Sentinel<I> S, WeaklyIncrementable O, class T,
class Proj = identity>
requires IndirectlyCopyable<I, O> &&
IndirectRelation<equal_to<>, Projected<I, Proj>, const T *>
IndirectCallableRelation<equal_to<>, Projected<I, Proj>, const T *>
pair<I, O> remove_copy(I first, S last, O result, const T& value, Proj proj = Proj{});

template<Input@\oldtxt{Iterable}\newtxt{Range}@ Rng, WeaklyIncrementable O, class T, class Proj = identity>
requires IndirectlyCopyable<IteratorType<Rng>, O> &&
IndirectRelation<equal_to<>, Projected<IteratorType<Rng>, Proj>, const T *>
IndirectCallableRelation<equal_to<>, Projected<IteratorType<Rng>, Proj>, const T *>
pair<IteratorType<Rng>, O>
remove_copy(Rng& rng, O result, const T& value, Proj proj = Proj{});

Expand Down
52 changes: 35 additions & 17 deletions concepts.tex
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,16 @@
\end{itemdecl}

\begin{itemdescr}
{\color{oldclr}
\pnum
The \tcode{Same} concept is used when requiring that two types are the same.
}

\pnum
\tcode{Same<T, U>} is an alias for \tcode{true} when \tcode{T} and \tcode{U}
denote the same \oldtxt{time}\newtxt{type} after the elimination of aliases; otherwise, it is an alias for
\tcode{false}. \tcode{Same<T, U>} shall have the same value as
\tcode{is_same<T, U>::value}.
\tcode{false}.\oldtxt{ \tcode{Same<T, U>} shall have the same value as
\tcode{is_same<T, U>::value}.}

\pnum
\remarks For the purposes of constraint checking, \tcode{Same<T, U>} implies
Expand All @@ -75,9 +77,11 @@
\end{itemdecl}

\begin{itemdescr}
{\color{oldclr}
\pnum
The \tcode{Derived} concept is used when requiring that a type \tcode{T} is derived
from \tcode{U}, or the same type as \tcode{U}.
}
\end{itemdescr}

\rSec2[concepts.lib.corelang.convertible]{Concept Convertible}
Expand All @@ -89,16 +93,15 @@
\end{itemdecl}

\begin{itemdescr}
{\color{oldclr}
\pnum
The \tcode{Convertible} concept \oldtxt{concept }expresses the requirement that a type
\tcode{T} can be implicitly converted to type \tcode{U}.
}
\end{itemdescr}

\rSec2[concepts.lib.corelang.common]{Concept Common}

\ednote{BUGBUG Think about whether \tcode{Common<unsigned, int>} satisfies the concept,
becuase signed<->unsigned is not unambiguously convertile.}

\pnum
Two types \tcode{T} and \tcode{U} are \techterm{unambiguously convertible} if
there exists a unique, explicit conversion from \tcode{T} to \tcode{U}, or from
Expand Down Expand Up @@ -158,32 +161,38 @@
concept bool Boolean =
requires(B b1, B b2) {
@\oldtxt{\{ }@bool(b1)@\oldtxt{ \}}@;
{ !b1 } -> Boolean;
@\newtxt{\{ b1 \} -> bool;}@
@\newtxt{bool(!b1);}@
{ !b1 } -> @\oldtxt{Boolean}\newtxt{bool}@;
@\oldtxt{requires Same<decltype(b1 \&\& b2), bool>};@
@\newtxt{\{b1 \&\& b2\} -> Same<bool>;}@
@\oldtxt{requires Same<decltype(b1 || b2), bool>;}@
@\newtxt{\{b1 || b2\} -> Same<bool>;}@
};
\end{itemdecl}

\ednote{Add a bullet about the required short-circuiting of \tcode{\&\&} and \tcode{||}.}

\pnum
The \tcode{Boolean} concept describes the requirements on a type that is
usable in Boolean contexts.
The \tcode{Boolean} concept describes the requirements on a type that is usable in Boolean contexts.

\pnum
Given values \tcode{b1} and \tcode{b2} of type \tcode{B}, and a value \tcode{t1} of
type \tcode{bool}, then type \tcode{B} models \tcode{Boolean} if and only if
Given values \tcode{b1} and \tcode{b2} of type \tcode{B}\oldtxt{, and a value \tcode{t1} of
type \tcode{bool}}, then type \tcode{B} models \tcode{Boolean} if and only if

\begin{itemize}
\item \tcode{bool(b1) == t1} for every value \tcode{b1} implicitly converted to
\tcode{t1}.
\item \tcode{bool(b1) == !bool(!b1)} for every value \tcode{b1}.
\item \tcode{(b1 \&\& b2) == (bool(b1) \&\& bool(b2))}.
\item \tcode{(b1 || b2) == (bool(b1) || bool(b2))}.
\item \tcode{bool(b1) == \oldtxt{t1}\newtxt{[](bool x) \{ return x; \}(b1)}}\oldtxt{ for every value
\tcode{b1} implicitly converted to \tcode{t1}}.
\item \tcode{bool(b1) == !bool(!b1)}\oldtxt{ for every value \tcode{b1}}.
\item \tcode{(b1 \&\& b2)}\oldtxt{ == }\newtxt{, \tcode{(b1 \&\& bool(b2))}, and
\tcode{(bool(b1) \&\& b2)} are all semantically identical to }
\tcode{(bool(b1) \&\& bool(b2))}\newtxt{, including short-circuit evaluation}.
\item \tcode{(b1 || b2)}\oldtxt{ == }\newtxt{, \tcode{(b1 || bool(b2))}, and
\tcode{(bool(b1) || b2)} are all semantically identical to }
\tcode{(bool(b1) || bool(b2))}\newtxt{, including short-circuit evaluation}.
\end{itemize}

{\color{newclr}\enterexample The types \tcode{bool}, \tcode{std::true_type}, and
\tcode{std::bitset<>::reference} are \tcode{Boolean} types.\exitexample}

\rSec2[concepts.lib.corelang.integral]{Concept Integral}

\indexlibrary{\idxcode{Integral}}%
Expand All @@ -193,9 +202,11 @@
\end{itemdecl}

\begin{itemdescr}
{\color{oldclr}
\pnum
The \tcode{Integral} concept is used when requiring that a type \tcode{T} is an
integral type~(\cxxref{basic.fundamental}).
}
\end{itemdescr}

\rSec2[concepts.lib.corelang.signedintegral]{Concept SignedIntegral}
Expand All @@ -208,9 +219,11 @@
\end{itemdecl}

\begin{itemdescr}
{\color{oldclr}
\pnum
The \tcode{SignedIntegral} concept is used when requiring that a type \tcode{T} is an
integral type that is signed.
}

\pnum
\enternote \tcode{SignedIntegral<T>} may be true even for types that are not signed
Expand All @@ -228,9 +241,11 @@
\end{itemdecl}

\begin{itemdescr}
{\color{oldclr}
\pnum
The \tcode{UnsignedIntegral} concept is used when requiring that a type \tcode{T} is an
integral type that is unsigned.
}

\pnum
\enternote \tcode{UnsignedIntegral<T>} may be true even for types that are not unsigned
Expand All @@ -239,6 +254,7 @@
\end{itemdescr}

\rSec2[concepts.lib.corelang.defaultconstructible]{Concept DefaultConstructible}

\ednote{Remove table [defaultconstructible] in [utility.arg.requirements]. Replace
references to [defaultconstructible] with references to
[concepts.lib.corelang.defaultconstructible].}
Expand Down Expand Up @@ -332,9 +348,11 @@
\end{itemdecl}

\begin{itemdescr}
{\color{oldclr}
\pnum
The \tcode{Constructible} concept is used when requiring that a type \tcode{T} is
constructible with arguments of types \tcode{Args...}.
}
\end{itemdescr}

\rSec2[concepts.lib.corelang.destructible]{Concept Destructible}
Expand Down
Loading

0 comments on commit 49c8620

Please sign in to comment.