Skip to content

[variant] Use \tcode for type designators, not math mode. #1125

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
Nov 27, 2016
Merged
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
122 changes: 61 additions & 61 deletions source/utilities.tex
Original file line number Diff line number Diff line change
Expand Up @@ -4220,7 +4220,7 @@

\pnum
In the descriptions that follow, let $i$ be in the range \range{0}{sizeof...(Types)},
and $T_i$ be the $i^{th}$ type in \tcode{Types...}.
and \tcode{T}$_i$ be the $i^{th}$ type in \tcode{Types...}.

\indexlibrary{\idxcode{variant}!constructor}%
\begin{itemdecl}
Expand All @@ -4230,25 +4230,25 @@
\begin{itemdescr}
\pnum
\effects
Constructs a \tcode{variant} holding a value-initialized value of type $T_0$.
Constructs a \tcode{variant} holding a value-initialized value of type \tcode{T}$_0$.

\pnum
\postconditions
\tcode{valueless_by_exception()} is \tcode{false} and \tcode{index()} is \tcode{0}.

\pnum
\throws
Any exception thrown by the value-initialization of $T_0$.
Any exception thrown by the value-initialization of \tcode{T}$_0$.

\pnum
\remarks
This function shall be \tcode{constexpr} if and only if the
value-initialization of the alternative type $T_0$ would satisfy the
value-initialization of the alternative type \tcode{T}$_0$ would satisfy the
requirements for a \tcode{constexpr} function.
The expression inside \tcode{noexcept} is equivalent to
\tcode{is_nothrow_default_constructible_v<$T_0$>}.
\tcode{is_nothrow_default_constructible_v<\tcode{T}$_0$>}.
This function shall not participate in overload resolution unless
\tcode{is_default_constructible_v<$T_0$>} is \tcode{true}.
\tcode{is_default_constructible_v<\tcode{T}$_0$>} is \tcode{true}.
\begin{note} See also class \tcode{monostate}. \end{note}
\end{itemdescr}

Expand All @@ -4267,12 +4267,12 @@

\pnum
\throws
Any exception thrown by direct-initializing any $T_i$ for all $i$.
Any exception thrown by direct-initializing any \tcode{T}$_i$ for all $i$.

\pnum
\remarks
This function shall not participate in overload resolution unless
\tcode{is_copy_constructible_v<$T_i$>} is \tcode{true} for all $i$.
\tcode{is_copy_constructible_v<\tcode{T}$_i$>} is \tcode{true} for all $i$.
\end{itemdescr}

\indexlibrary{\idxcode{variant}!constructor}%
Expand All @@ -4290,14 +4290,14 @@

\pnum
\throws
Any exception thrown by move-constructing any $T_i$ for all $i$.
Any exception thrown by move-constructing any \tcode{T}$_i$ for all $i$.

\pnum
\remarks
The expression inside \tcode{noexcept} is equivalent to the logical AND of
\tcode{is_nothrow_move_constructible_v<$T_i$>} for all $i$.
\tcode{is_nothrow_move_constructible_v<\tcode{T}$_i$>} for all $i$.
This function shall not participate in overload resolution unless
\tcode{is_move_constructible_v<$T_i$>} is \tcode{true} for all $i$.
\tcode{is_move_constructible_v<\tcode{T}$_i$>} is \tcode{true} for all $i$.
\end{itemdescr}

\indexlibrary{\idxcode{variant}!constructor}%
Expand All @@ -4307,25 +4307,25 @@

\begin{itemdescr}
\pnum
Let $T_j$ be a type that is determined as follows:
build an imaginary function \tcode{\textit{FUN}($T_i$)} for each alternative type $T_i$. The overload \tcode{\textit{FUN}($T_j$)} selected by overload
Let \tcode{T}$_j$ be a type that is determined as follows:
build an imaginary function \tcode{\textit{FUN}(\tcode{T}$_i$)} for each alternative type \tcode{T}$_i$. The overload \tcode{\textit{FUN}(\tcode{T}$_j$)} selected by overload
resolution for the expression \tcode{\textit{FUN}(std::forward<T>(\brk{}t))} defines
the alternative $T_j$ which is the type of the contained value after
the alternative \tcode{T}$_j$ which is the type of the contained value after
construction.

\pnum
\effects
Initializes \tcode{*this} to hold the alternative type $T_j$ and
Initializes \tcode{*this} to hold the alternative type \tcode{T}$_j$ and
direct-initializes the contained value as if direct-non-list-initializing it
with \tcode{std::forward<T>(t)}.

\pnum
\postconditions
\tcode{holds_alternative<$T_j$>(*this)} is \tcode{true}.
\tcode{holds_alternative<T$_j$>(*this)} is \tcode{true}.

\pnum
\throws
Any exception thrown by the initialization of the selected alternative $T_j$.
Any exception thrown by the initialization of the selected alternative \tcode{T}$_j$.

\pnum
\remarks
Expand All @@ -4334,7 +4334,7 @@
unless \tcode{decay_t<T>} is neither
a specialization of \tcode{in_place_type_t}
nor a specialization of \tcode{in_place_index_t},
unless \tcode{is_constructible_v<$T_j$, T>} is \tcode{true},
unless \tcode{is_constructible_v<T$_j$, T>} is \tcode{true},
and unless the expression
\tcode{\textit{FUN}(}\brk\tcode{std::forward<T>(t))} (with \tcode{\textit{FUN}}
being the above-mentioned set of imaginary functions) is well formed.
Expand All @@ -4349,8 +4349,8 @@

\pnum
The expression inside \tcode{noexcept} is equivalent to
\tcode{is_nothrow_constructible_v<$T_j$, T>}.
If $T_j$'s selected constructor is a constexpr constructor,
\tcode{is_nothrow_constructible_v<T$_j$, T>}.
If \tcode{T}$_j$'s selected constructor is a constexpr constructor,
this constructor shall be a constexpr constructor.
\end{itemdescr}

Expand Down Expand Up @@ -4418,7 +4418,7 @@
\begin{itemdescr}
\pnum
\effects
Initializes the contained value as if constructing an object of type $T_I$
Initializes the contained value as if constructing an object of type \tcode{T}$_I$
with the arguments \tcode{std::forward<Args>(args)...}.

\pnum
Expand All @@ -4427,13 +4427,13 @@

\pnum
\throws
Any exception thrown by calling the selected constructor of $T_I$.
Any exception thrown by calling the selected constructor of \tcode{T}$_I$.

\pnum
\remarks
This function shall not participate in overload resolution unless \tcode{I} is
less than \tcode{sizeof...(Types)} and \tcode{is_constructible_v<$T_I$, Args...>} is \tcode{true}.
If $T_I$'s selected constructor is a \tcode{constexpr} constructor, this
less than \tcode{sizeof...(Types)} and \tcode{is_constructible_v<T$_I$, Args...>} is \tcode{true}.
If \tcode{T}$_I$'s selected constructor is a \tcode{constexpr} constructor, this
constructor shall be a constexpr constructor.
\end{itemdescr}

Expand All @@ -4447,7 +4447,7 @@
\pnum
\effects
Initializes the contained value as if constructing an object of type
$T_I$ with the arguments \tcode{il, std::forward<Args>(args)...}.
\tcode{T}$_I$ with the arguments \tcode{il, std::forward<Args>(args)...}.

\pnum
\postconditions
Expand All @@ -4457,8 +4457,8 @@
\remarks
This function shall not participate in overload resolution unless \tcode{I} is
less than \tcode{sizeof...(Types)} and
\tcode{is_constructible_v<$T_I$, initializer_list<U>\&, Args...>} is \tcode{true}.
If $T_I$'s selected constructor is a \tcode{constexpr} constructor, this
\tcode{is_constructible_v<T$_I$, initializer_list<U>\&, Args...>} is \tcode{true}.
If \tcode{T}$_I$'s selected constructor is a \tcode{constexpr} constructor, this
constructor shall be a constexpr constructor.
\end{itemdescr}

Expand Down Expand Up @@ -4511,7 +4511,7 @@

\pnum
\remarks
If \tcode{is_trivially_destructible_v<$T_i$> == true} for all $T_i$
If \tcode{is_trivially_destructible_v<T$_i$> == true} for all \tcode{T}$_i$
then this destructor shall be a trivial destructor.
\end{itemdescr}

Expand All @@ -4538,8 +4538,8 @@
copies the value contained in \tcode{rhs} to a temporary, then destroys any
value contained in \tcode{*this}. Sets \tcode{*this} to hold the same
alternative index as \tcode{rhs} and initializes the value contained in
\tcode{*this} as if direct-non-list-initializing an object of type $T_j$
with \tcode{std::forward<$T_j$>(TMP),} with \tcode{TMP} being the temporary and
\tcode{*this} as if direct-non-list-initializing an object of type \tcode{T}$_j$
with \tcode{std::forward<T$_j$>(TMP),} with \tcode{TMP} being the temporary and
$j$ being \tcode{rhs.index()}.
\end{itemize}

Expand All @@ -4552,15 +4552,15 @@
\pnum
\remarks
This function shall not participate in overload resolution unless
\tcode{is_copy_constructible_v<$T_i$> \&\& is_move_constructible_v<$T_i$> \&\& is_copy_assignable_v<$T_i$>}
\tcode{is_copy_constructible_v<T$_i$> \&\& is_move_constructible_v<T$_i$> \&\& is_copy_assignable_v<T$_i$>}
is \tcode{true} for all $i$.
\begin{itemize}
\item If an exception is thrown during the call to $T_j$'s copy assignment,
\item If an exception is thrown during the call to \tcode{T}$_j$'s copy assignment,
the state of the contained value is as defined by the exception safety
guarantee of $T_j$'s copy assignment; \tcode{index()} will be $j$.
\item If an exception is thrown during the call to $T_j$'s copy construction
guarantee of \tcode{T}$_j$'s copy assignment; \tcode{index()} will be $j$.
\item If an exception is thrown during the call to \tcode{T}$_j$'s copy construction
(with $j$ being \tcode{rhs.index()}), \tcode{*this} will remain unchanged.
\item If an exception is thrown during the call to $T_j$'s move construction,
\item If an exception is thrown during the call to \tcode{T}$_j$'s move construction,
the \tcode{variant} will hold no value.
\end{itemize}
\end{itemdescr}
Expand All @@ -4585,7 +4585,7 @@
\item
destroys any value contained in \tcode{*this}. Sets \tcode{*this} to hold the
same alternative index as \tcode{rhs} and initializes the value contained in
\tcode{*this} as if direct-non-list-initializing an object of type $T_j$
\tcode{*this} as if direct-non-list-initializing an object of type \tcode{T}$_j$
with \tcode{get<$j$>(std::move(rhs))} with $j$ being \tcode{rhs.index()}.
\end{itemize}

Expand All @@ -4595,16 +4595,16 @@
\pnum
\remarks
This function shall not participate in overload resolution unless
\tcode{is_move_constructible_v<$T_i$> \&\& is_move_assignable_v<$T_i$>} is
\tcode{is_move_constructible_v<T$_i$> \&\& is_move_assignable_v<T$_i$>} is
\tcode{true} for all $i$.
The expression inside \tcode{noexcept} is equivalent to:
\tcode{is_nothrow_move_constructible_v<$T_i$> \&\& is_nothrow_move_assignable_v<$T_i$>} for all $i$.
\tcode{is_nothrow_move_constructible_v<T$_i$> \&\& is_nothrow_move_assignable_v<T$_i$>} for all $i$.
\begin{itemize}
\item If an exception is thrown during the call to $T_j$'s move construction
\item If an exception is thrown during the call to \tcode{T}$_j$'s move construction
(with $j$ being \tcode{rhs.index())}, the \tcode{variant} will hold no value.
\item If an exception is thrown during the call to $T_j$'s move assignment,
\item If an exception is thrown during the call to \tcode{T}$_j$'s move assignment,
the state of the contained value is as defined by the exception safety
guarantee of $T_j$'s move assignment; \tcode{index()} will be $j$.
guarantee of \tcode{T}$_j$'s move assignment; \tcode{index()} will be $j$.
\end{itemize}
\end{itemdescr}

Expand All @@ -4615,25 +4615,25 @@

\begin{itemdescr}
\pnum
Let $T_j$ be a type that is determined as follows:
build an imaginary function \tcode{\textit{FUN}($T_i$)} for each alternative type
$T_i$. The overload \tcode{\textit{FUN}($T_j$)} selected by overload
Let \tcode{T}$_j$ be a type that is determined as follows:
build an imaginary function \tcode{\textit{FUN}(T$_i$)} for each alternative type
\tcode{T}$_i$. The overload \tcode{\textit{FUN}(T$_j$)} selected by overload
resolution for the expression \tcode{\textit{FUN}(std::forward<T>(\brk{}t))} defines
the alternative $T_j$ which is the type of the contained value after
the alternative \tcode{T}$_j$ which is the type of the contained value after
assignment.

\pnum
\effects
If \tcode{*this} holds a $T_j$, assigns \tcode{std::forward<T>(t)} to
If \tcode{*this} holds a \tcode{T}$_j$, assigns \tcode{std::forward<T>(t)} to
the value contained in \tcode{*this}. Otherwise, destroys any value contained
in \tcode{*this}, sets \tcode{*this} to hold the alternative type $T_j$
in \tcode{*this}, sets \tcode{*this} to hold the alternative type \tcode{T}$_j$
as selected by the imaginary function overload resolution described above,
and direct-initializes the contained value as if direct-non-list-initializing
it with \tcode{std::forward<T>(t)}.

\pnum
\postconditions
\tcode{holds_alternative<$T_j$>(*this)} is \tcode{true}, with $T_j$
\tcode{holds_alternative<T$_j$>(*this)} is \tcode{true}, with \tcode{T}$_j$
selected by the imaginary function overload resolution described above.

\pnum
Expand All @@ -4643,7 +4643,7 @@
\remarks
This function shall not participate in overload resolution unless
\tcode{is_same_v<decay_t<T>, variant>} is \tcode{false}, unless
\tcode{is_assignable_v<$T_j$\&, T> \&\& is_constructible_v<$T_j$, T>} is \tcode{true},
\tcode{is_assignable_v<T$_j$\&, T> \&\& is_constructible_v<T$_j$, T>} is \tcode{true},
and unless the expression \tcode{\textit{FUN}(std::forward<T>(t))} (with
\tcode{\textit{FUN}} being the above-mentioned set of imaginary functions)
is well formed.
Expand All @@ -4659,7 +4659,7 @@

\pnum
The expression inside \tcode{noexcept} is equivalent to:
\tcode{is_nothrow_assignable_v<$T_j$\&, T> \&\& is_nothrow_constructible_v<$T_j$, T>}.
\tcode{is_nothrow_assignable_v<T$_j$\&, T> \&\& is_nothrow_constructible_v<T$_j$, T>}.
\begin{itemize}
\item If an exception is thrown during the assignment of \tcode{std::forward<T>(t)}
to the value contained in \tcode{*this}, the state of the contained value and
Expand Down Expand Up @@ -4722,7 +4722,7 @@
\effects
Destroys the currently contained value if \tcode{valueless_by_exception()}
is \tcode{false}. Then direct-initializes the contained value as if
constructing a value of type $T_I$ with the arguments
constructing a value of type \tcode{T}$_I$ with the arguments
\tcode{std::forward<Ar\-gs>(args)...}.

\pnum
Expand All @@ -4736,7 +4736,7 @@
\pnum
\remarks
This function shall not participate in overload resolution unless
\tcode{is_constructible_v<$T_I$, Args...>} is \tcode{true}.
\tcode{is_constructible_v<T$_I$, Args...>} is \tcode{true}.
If an exception is thrown during the initialization of the contained value,
the \tcode{variant} might not hold a value.
\end{itemdescr}
Expand All @@ -4755,7 +4755,7 @@
\effects
Destroys the currently contained value if \tcode{valueless_by_exception()}
is \tcode{false}. Then direct-initializes the contained value as if
constructing a value of type $T_I$ with the arguments
constructing a value of type \tcode{T}$_I$ with the arguments
\tcode{il, std::forward<Args>(args)...}.

\pnum
Expand All @@ -4769,7 +4769,7 @@
\pnum
\remarks
This function shall not participate in overload resolution unless
\tcode{is_constructible_v<$T_I$, initializer_list<U>\&, Args...>} is \tcode{true}.
\tcode{is_constructible_v<T$_I$, initializer_list<U>\&, Args...>} is \tcode{true}.
If an exception is thrown during the initialization of the contained value,
the \tcode{variant} might not hold a value.
\end{itemdescr}
Expand Down Expand Up @@ -4821,8 +4821,8 @@

\begin{itemdescr}
\pnum
\requires Lvalues of type \tcode{$T_i$} shall be swappable~(\ref{swappable.requirements}) and
\tcode{is_move_constructible_v<$T_i$>} shall be \tcode{true} for all $i$.
\requires Lvalues of type \tcode{T}$_i$ shall be swappable~(\ref{swappable.requirements}) and
\tcode{is_move_constructible_v<T$_i$>} shall be \tcode{true} for all $i$.

\pnum
\effects
Expand All @@ -4841,20 +4841,20 @@
any exception thrown by \tcode{swap(get<$i$>(*this), get<$i$>(rhs))}
with $i$ being \tcode{index()}.
Otherwise, any exception thrown by the move constructor
of \tcode{$T_i$} or \tcode{$T_j$}
of \tcode{T}$_i$ or \tcode{T}$_j$
with $i$ being \tcode{index()} and $j$ being \tcode{rhs.index()}.

\pnum
\remarks
If an exception is thrown during the call to function \tcode{swap(get<$i$>(*this), get<$i$>(rhs))},
the states of the contained values of \tcode{*this} and of \tcode{rhs} are
determined by the exception safety guarantee of \tcode{swap} for lvalues of
$T_i$ with $i$ being \tcode{index()}.
\tcode{T}$_i$ with $i$ being \tcode{index()}.
If an exception is thrown during the exchange of the values of \tcode{*this}
and \tcode{rhs}, the states of the values of \tcode{*this} and of \tcode{rhs}
are determined by the exception safety guarantee of \tcode{variant}'s move constructor.
The expression inside \tcode{noexcept} is equivalent to the logical AND of
\tcode{is_nothrow_move_constructible_v<$T_i$> \&\& is_nothrow_swappable_v<$T_i$>} for all $i$.
\tcode{is_nothrow_move_constructible_v<T$_i$> \&\& is_nothrow_swappable_v<T$_i$>} for all $i$.
\end{itemdescr}

\rSec2[variant.helper]{\tcode{variant} helper classes}
Expand Down Expand Up @@ -4924,7 +4924,7 @@
\requires \tcode{I < sizeof...(Types)}.

\pnum
\textit{Value:} The type $T_I$.
\textit{Value:} The type \tcode{T}$_I$.
\end{itemdescr}

\rSec2[variant.get]{Value access}
Expand Down Expand Up @@ -5244,7 +5244,7 @@

\pnum
\remarks This function shall not participate in overload resolution
unless \tcode{is_move_constructible_v<$T_i$> \&\& is_swappable_v<$T_i$>}
unless \tcode{is_move_constructible_v<T$_i$> \&\& is_swappable_v<T$_i$>}
is \tcode{true} for all $i$.
The expression inside \tcode{noexcept} is equivalent to \tcode{noexcept(v.swap(w))}.
\end{itemdescr}
Expand Down