From cda73c98cf61ea8928c5d8b6b8987c33ecf4229a Mon Sep 17 00:00:00 2001 From: Jens Maurer Date: Tue, 13 Dec 2016 18:45:52 +0100 Subject: [PATCH] [any] Rename the ValueType template parameter to T. The parameter has a confusing name: It is not actually the value type contained in the 'any'. Where the new T clashes with an existing use of T, rename the latter to VT, since this is actually the value type of the 'any'. Fixes #1202. --- source/utilities.tex | 160 +++++++++++++++++++++---------------------- 1 file changed, 80 insertions(+), 80 deletions(-) diff --git a/source/utilities.tex b/source/utilities.tex index f419cfac02..a2b40e136c 100644 --- a/source/utilities.tex +++ b/source/utilities.tex @@ -5338,17 +5338,17 @@ template any make_any(initializer_list il, Args&& ...args); - template - ValueType any_cast(const any& operand); - template - ValueType any_cast(any& operand); - template - ValueType any_cast(any&& operand); + template + T any_cast(const any& operand); + template + T any_cast(any& operand); + template + T any_cast(any&& operand); - template - const ValueType* any_cast(const any* operand) noexcept; - template - ValueType* any_cast(any* operand) noexcept; + template + const T* any_cast(const any* operand) noexcept; + template + T* any_cast(any* operand) noexcept; } \end{codeblock} @@ -5376,12 +5376,12 @@ any(const any& other); any(any&& other) noexcept; - template any(ValueType&& value); + template any(T&& value); - template - explicit any(in_place_type_t, Args&&...); - template - explicit any(in_place_type_t, initializer_list, Args&&...); + template + explicit any(in_place_type_t, Args&&...); + template + explicit any(in_place_type_t, initializer_list, Args&&...); ~any(); @@ -5389,12 +5389,12 @@ any& operator=(const any& rhs); any& operator=(any&& rhs) noexcept; - template any& operator=(ValueType&& rhs); + template any& operator=(T&& rhs); // \ref{any.modifiers}, modifiers - template + template void emplace(Args&& ...); - template + template void emplace(initializer_list, Args&&...); void reset() noexcept; void swap(any& rhs) noexcept; @@ -5467,92 +5467,92 @@ \indexlibrary{\idxcode{any}!constructor}% \begin{itemdecl} -template -any(ValueType&& value); +template + any(T&& value); \end{itemdecl} \begin{itemdescr} \pnum -Let \tcode{T} be \tcode{decay_t}. +Let \tcode{VT} be \tcode{decay_t}. \pnum \requires -\tcode{T} shall satisfy the \tcode{CopyConstructible} requirements. +\tcode{VT} shall satisfy the \tcode{CopyConstructible} requirements. \pnum \effects -Constructs an object of type \tcode{any} that contains an object of type \tcode{T} direct-initialized with \tcode{std::forward(value)}. +Constructs an object of type \tcode{any} that contains an object of type \tcode{VT} direct-initialized with \tcode{std::forward(value)}. \pnum \remarks This constructor shall not participate in overload resolution unless -\tcode{T} is not the same type as \tcode{any}, -\tcode{T} is not a specialization of \tcode{in_place_type_t}, -and \tcode{is_copy_constructible_v} is \tcode{true}. +\tcode{VT} is not the same type as \tcode{any}, +\tcode{VT} is not a specialization of \tcode{in_place_type_t}, +and \tcode{is_copy_constructible_v} is \tcode{true}. \pnum \throws -Any exception thrown by the selected constructor of \tcode{T}. +Any exception thrown by the selected constructor of \tcode{VT}. \end{itemdescr} \indexlibrary{\idxcode{any}!constructor}% \begin{itemdecl} -template - explicit any(in_place_type_t, Args&&... args); +template + explicit any(in_place_type_t, Args&&... args); \end{itemdecl} \begin{itemdescr} \pnum -Let \tcode{T} be \tcode{decay_t}. +Let \tcode{VT} be \tcode{decay_t}. \pnum -\requires \tcode{T} shall satisfy the \tcode{CopyConstructible} requirements. +\requires \tcode{VT} shall satisfy the \tcode{CopyConstructible} requirements. \pnum \effects Initializes the contained value as if direct-non-list-initializing an object of -type \tcode{T} with the arguments \tcode{std::forward(args)...}. +type \tcode{VT} with the arguments \tcode{std::forward(args)...}. \pnum -\postconditions \tcode{*this} contains a value of type \tcode{T}. +\postconditions \tcode{*this} contains a value of type \tcode{VT}. \pnum -\throws Any exception thrown by the selected constructor of \tcode{T}. +\throws Any exception thrown by the selected constructor of \tcode{VT}. \pnum \remarks This constructor shall not participate in overload resolution unless -\tcode{is_copy_constructible_v} is \tcode{true} and -\tcode{is_constructible_v} is \tcode{true}. +\tcode{is_copy_constructible_v} is \tcode{true} and +\tcode{is_constructible_v} is \tcode{true}. \end{itemdescr} \indexlibrary{\idxcode{any}!constructor}% \begin{itemdecl} -template - explicit any(in_place_type_t, initializer_list il, Args&&... args); +template + explicit any(in_place_type_t, initializer_list il, Args&&... args); \end{itemdecl} \begin{itemdescr} \pnum -Let \tcode{T} be \tcode{decay_t}. +Let \tcode{VT} be \tcode{decay_t}. \pnum -\requires \tcode{T} shall satisfy the \tcode{CopyConstructible} requirements. +\requires \tcode{VT} shall satisfy the \tcode{CopyConstructible} requirements. \pnum \effects Initializes the contained value as if direct-non-list-initializing an object of -type \tcode{T} with the arguments \tcode{il, std::forward(args)...}. +type \tcode{VT} with the arguments \tcode{il, std::forward(args)...}. \pnum \postconditions \tcode{*this} contains a value. \pnum -\throws Any exception thrown by the selected constructor of \tcode{T}. +\throws Any exception thrown by the selected constructor of \tcode{VT}. \pnum \remarks This constructor shall not participate in overload resolution unless -\tcode{is_copy_constructible_v} is \tcode{true} and -\tcode{is_constructible_v\&, Args...>} is \tcode{true}. +\tcode{is_copy_constructible_v} is \tcode{true} and +\tcode{is_constructible_v\&, Args...>} is \tcode{true}. \end{itemdescr} \indexlibrary{\idxcode{any}!destructor} @@ -5610,21 +5610,21 @@ \indexlibrarymember{operator=}{any}% \begin{itemdecl} -template -any& operator=(ValueType&& rhs); +template + any& operator=(T&& rhs); \end{itemdecl} \begin{itemdescr} \pnum -Let \tcode{T} be \tcode{decay_t}. +Let \tcode{VT} be \tcode{decay_t}. \pnum \requires -\tcode{T} shall satisfy the \tcode{CopyConstructible} requirements. +\tcode{VT} shall satisfy the \tcode{CopyConstructible} requirements. \pnum \effects -Constructs an object \tcode{tmp} of type \tcode{any} that contains an object of type \tcode{T} direct-initialized with \tcode{std::forward(rhs)}, and \tcode{tmp.swap(*this)}. +Constructs an object \tcode{tmp} of type \tcode{any} that contains an object of type \tcode{VT} direct-initialized with \tcode{std::forward(rhs)}, and \tcode{tmp.swap(*this)}. No effects if an exception is thrown. \pnum @@ -5646,70 +5646,70 @@ \indexlibrarymember{emplace}{any}% \begin{itemdecl} -template +template void emplace(Args&&... args); \end{itemdecl} \begin{itemdescr} \pnum -Let \tcode{T} be \tcode{decay_t}. +Let \tcode{VT} be \tcode{decay_t}. \pnum \requires -\tcode{T} shall satisfy the \tcode{CopyConstructible} requirements. +\tcode{VT} shall satisfy the \tcode{CopyConstructible} requirements. \pnum \effects Calls \tcode{reset()}. Then initializes the contained value as if direct-non-list-initializing -an object of type \tcode{T} with the arguments \tcode{std::forward(args)...}. +an object of type \tcode{VT} with the arguments \tcode{std::forward(args)...}. \pnum \postconditions \tcode{*this} contains a value. \pnum -\throws Any exception thrown by the selected constructor of \tcode{T}. +\throws Any exception thrown by the selected constructor of \tcode{VT}. \pnum -\remarks If an exception is thrown during the call to \tcode{T}'s constructor, +\remarks If an exception is thrown during the call to \tcode{VT}'s constructor, \tcode{*this} does not contain a value, and any previously contained object has been destroyed. This function shall not participate in overload resolution unless -\tcode{is_copy_constructible_v} is \tcode{true} and -\tcode{is_constructible_v} is \tcode{true}. +\tcode{is_copy_constructible_v} is \tcode{true} and +\tcode{is_constructible_v} is \tcode{true}. \end{itemdescr} \indexlibrarymember{emplace}{any}% \begin{itemdecl} -template +template void emplace(initializer_list il, Args&&... args); \end{itemdecl} \begin{itemdescr} \pnum -Let \tcode{T} be \tcode{decay_t}. +Let \tcode{VT} be \tcode{decay_t}. \pnum \requires -\tcode{T} shall satisfy the \tcode{CopyConstructible} requirements. +\tcode{VT} shall satisfy the \tcode{CopyConstructible} requirements. \pnum \effects Calls \tcode{reset()}. Then initializes the contained value -as if direct-non-list-initializing an object of type \tcode{T} with the arguments +as if direct-non-list-initializing an object of type \tcode{VT} with the arguments \tcode{il, std::forward (args)...}. \pnum \postconditions \tcode{*this} contains a value. \pnum -\throws Any exception thrown by the selected constructor of \tcode{T}. +\throws Any exception thrown by the selected constructor of \tcode{VT}. \pnum -\remarks If an exception is thrown during the call to \tcode{T}'s constructor, +\remarks If an exception is thrown during the call to \tcode{VT}'s constructor, \tcode{*this} does not contain a value, and any previously contained object has been destroyed. The function shall not participate in overload resolution unless -\tcode{is_copy_constructible_v} is \tcode{true} and -\tcode{is_constructible_v\&, Args...>} is \tcode{true}. +\tcode{is_copy_constructible_v} is \tcode{true} and +\tcode{is_constructible_v\&, Args...>} is \tcode{true}. \end{itemdescr} \indexlibrarymember{reset}{any}% @@ -5808,28 +5808,28 @@ \indexlibrary{\idxcode{any_cast}}% \begin{itemdecl} -template - ValueType any_cast(const any& operand); -template - ValueType any_cast(any& operand); -template - ValueType any_cast(any&& operand); +template + T any_cast(const any& operand); +template + T any_cast(any& operand); +template + T any_cast(any&& operand); \end{itemdecl} \begin{itemdescr} \pnum \requires -\tcode{is_reference_v} is \tcode{true} or \tcode{is_copy_constructible_v} is \tcode{true}. +\tcode{is_reference_v} is \tcode{true} or \tcode{is_copy_constructible_v} is \tcode{true}. Otherwise the program is ill-formed. \pnum \returns -For the first form, \tcode{*any_cast>>(\&operand)}. -For the second and third forms, \tcode{*any_cast>(\&operand)}. +For the first form, \tcode{*any_cast>>(\&operand)}. +For the second and third forms, \tcode{*any_cast>(\&operand)}. \pnum \throws -\tcode{bad_any_cast} if \tcode{operand.type() != typeid(remove_reference_t)}. +\tcode{bad_any_cast} if \tcode{operand.type() != typeid(remove_reference_t)}. \pnum \begin{example} @@ -5863,16 +5863,16 @@ \indexlibrary{\idxcode{any_cast}}% \begin{itemdecl} -template - const ValueType* any_cast(const any* operand) noexcept; -template - ValueType* any_cast(any* operand) noexcept; +template + const T* any_cast(const any* operand) noexcept; +template + T* any_cast(any* operand) noexcept; \end{itemdecl} \begin{itemdescr} \pnum \returns -If \tcode{operand != nullptr \&\& operand->type() == typeid(ValueType)}, +If \tcode{operand != nullptr \&\& operand->type() == typeid(T)}, a pointer to the object contained by \tcode{operand}; otherwise, \tcode{nullptr}.