Skip to content

Commit 9f9bdf4

Browse files
committed
[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.
1 parent aefc83c commit 9f9bdf4

File tree

1 file changed

+80
-80
lines changed

1 file changed

+80
-80
lines changed

source/utilities.tex

Lines changed: 80 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -5338,17 +5338,17 @@
53385338
template <class T, class U, class... Args>
53395339
any make_any(initializer_list<U> il, Args&& ...args);
53405340

5341-
template<class ValueType>
5342-
ValueType any_cast(const any& operand);
5343-
template<class ValueType>
5344-
ValueType any_cast(any& operand);
5345-
template<class ValueType>
5346-
ValueType any_cast(any&& operand);
5341+
template<class T>
5342+
T any_cast(const any& operand);
5343+
template<class T>
5344+
T any_cast(any& operand);
5345+
template<class T>
5346+
T any_cast(any&& operand);
53475347

5348-
template<class ValueType>
5349-
const ValueType* any_cast(const any* operand) noexcept;
5350-
template<class ValueType>
5351-
ValueType* any_cast(any* operand) noexcept;
5348+
template<class T>
5349+
const T* any_cast(const any* operand) noexcept;
5350+
template<class T>
5351+
T* any_cast(any* operand) noexcept;
53525352
}
53535353
\end{codeblock}
53545354

@@ -5376,25 +5376,25 @@
53765376
any(const any& other);
53775377
any(any&& other) noexcept;
53785378

5379-
template <class ValueType> any(ValueType&& value);
5379+
template <class T> any(T&& value);
53805380

5381-
template <class ValueType, class... Args>
5382-
explicit any(in_place_type_t<ValueType>, Args&&...);
5383-
template <class ValueType, class U, class... Args>
5384-
explicit any(in_place_type_t<ValueType>, initializer_list<U>, Args&&...);
5381+
template <class T, class... Args>
5382+
explicit any(in_place_type_t<T>, Args&&...);
5383+
template <class T, class U, class... Args>
5384+
explicit any(in_place_type_t<T>, initializer_list<U>, Args&&...);
53855385

53865386
~any();
53875387

53885388
// \ref{any.assign}, assignments
53895389
any& operator=(const any& rhs);
53905390
any& operator=(any&& rhs) noexcept;
53915391

5392-
template <class ValueType> any& operator=(ValueType&& rhs);
5392+
template <class T> any& operator=(T&& rhs);
53935393

53945394
// \ref{any.modifiers}, modifiers
5395-
template <class ValueType, class... Args>
5395+
template <class T, class... Args>
53965396
void emplace(Args&& ...);
5397-
template <class ValueType, class U, class... Args>
5397+
template <class T, class U, class... Args>
53985398
void emplace(initializer_list<U>, Args&&...);
53995399
void reset() noexcept;
54005400
void swap(any& rhs) noexcept;
@@ -5467,92 +5467,92 @@
54675467

54685468
\indexlibrary{\idxcode{any}!constructor}%
54695469
\begin{itemdecl}
5470-
template<class ValueType>
5471-
any(ValueType&& value);
5470+
template<class T>
5471+
any(T&& value);
54725472
\end{itemdecl}
54735473

54745474
\begin{itemdescr}
54755475
\pnum
5476-
Let \tcode{T} be \tcode{decay_t<ValueType>}.
5476+
Let \tcode{VT} be \tcode{decay_t<T>}.
54775477

54785478
\pnum
54795479
\requires
5480-
\tcode{T} shall satisfy the \tcode{CopyConstructible} requirements.
5480+
\tcode{VT} shall satisfy the \tcode{CopyConstructible} requirements.
54815481

54825482
\pnum
54835483
\effects
5484-
Constructs an object of type \tcode{any} that contains an object of type \tcode{T} direct-initialized with \tcode{std::forward<ValueType>(value)}.
5484+
Constructs an object of type \tcode{any} that contains an object of type \tcode{VT} direct-initialized with \tcode{std::forward<T>(value)}.
54855485

54865486
\pnum
54875487
\remarks
54885488
This constructor shall not participate in overload resolution unless
5489-
\tcode{T} is not the same type as \tcode{any},
5490-
\tcode{T} is not a specialization of \tcode{in_place_type_t},
5491-
and \tcode{is_copy_constructible_v<T>} is \tcode{true}.
5489+
\tcode{VT} is not the same type as \tcode{any},
5490+
\tcode{VT} is not a specialization of \tcode{in_place_type_t},
5491+
and \tcode{is_copy_constructible_v<VT>} is \tcode{true}.
54925492

54935493
\pnum
54945494
\throws
5495-
Any exception thrown by the selected constructor of \tcode{T}.
5495+
Any exception thrown by the selected constructor of \tcode{VT}.
54965496
\end{itemdescr}
54975497

54985498
\indexlibrary{\idxcode{any}!constructor}%
54995499
\begin{itemdecl}
5500-
template <class ValueType, class... Args>
5501-
explicit any(in_place_type_t<ValueType>, Args&&... args);
5500+
template <class T, class... Args>
5501+
explicit any(in_place_type_t<T>, Args&&... args);
55025502
\end{itemdecl}
55035503

55045504
\begin{itemdescr}
55055505
\pnum
5506-
Let \tcode{T} be \tcode{decay_t<ValueType>}.
5506+
Let \tcode{VT} be \tcode{decay_t<T>}.
55075507

55085508
\pnum
5509-
\requires \tcode{T} shall satisfy the \tcode{CopyConstructible} requirements.
5509+
\requires \tcode{VT} shall satisfy the \tcode{CopyConstructible} requirements.
55105510

55115511
\pnum
55125512
\effects Initializes the contained value as if direct-non-list-initializing an object of
5513-
type \tcode{T} with the arguments \tcode{std::forward<Args>(args)...}.
5513+
type \tcode{VT} with the arguments \tcode{std::forward<Args>(args)...}.
55145514

55155515
\pnum
5516-
\postconditions \tcode{*this} contains a value of type \tcode{T}.
5516+
\postconditions \tcode{*this} contains a value of type \tcode{VT}.
55175517

55185518
\pnum
5519-
\throws Any exception thrown by the selected constructor of \tcode{T}.
5519+
\throws Any exception thrown by the selected constructor of \tcode{VT}.
55205520

55215521
\pnum
55225522
\remarks
55235523
This constructor shall not participate in overload resolution unless
5524-
\tcode{is_copy_constructible_v<T>} is \tcode{true} and
5525-
\tcode{is_constructible_v<T, Args...>} is \tcode{true}.
5524+
\tcode{is_copy_constructible_v<VT>} is \tcode{true} and
5525+
\tcode{is_constructible_v<VT, Args...>} is \tcode{true}.
55265526
\end{itemdescr}
55275527

55285528
\indexlibrary{\idxcode{any}!constructor}%
55295529
\begin{itemdecl}
5530-
template <class ValueType, class U, class... Args>
5531-
explicit any(in_place_type_t<ValueType>, initializer_list<U> il, Args&&... args);
5530+
template <class T, class U, class... Args>
5531+
explicit any(in_place_type_t<T>, initializer_list<U> il, Args&&... args);
55325532
\end{itemdecl}
55335533

55345534
\begin{itemdescr}
55355535
\pnum
5536-
Let \tcode{T} be \tcode{decay_t<ValueType>}.
5536+
Let \tcode{VT} be \tcode{decay_t<T>}.
55375537

55385538
\pnum
5539-
\requires \tcode{T} shall satisfy the \tcode{CopyConstructible} requirements.
5539+
\requires \tcode{VT} shall satisfy the \tcode{CopyConstructible} requirements.
55405540

55415541
\pnum
55425542
\effects Initializes the contained value as if direct-non-list-initializing an object of
5543-
type \tcode{T} with the arguments \tcode{il, std::forward<Args>(args)...}.
5543+
type \tcode{VT} with the arguments \tcode{il, std::forward<Args>(args)...}.
55445544

55455545
\pnum
55465546
\postconditions \tcode{*this} contains a value.
55475547

55485548
\pnum
5549-
\throws Any exception thrown by the selected constructor of \tcode{T}.
5549+
\throws Any exception thrown by the selected constructor of \tcode{VT}.
55505550

55515551
\pnum
55525552
\remarks
55535553
This constructor shall not participate in overload resolution unless
5554-
\tcode{is_copy_constructible_v<T>} is \tcode{true} and
5555-
\tcode{is_constructible_v<T, initializer_list<U>\&, Args...>} is \tcode{true}.
5554+
\tcode{is_copy_constructible_v<VT>} is \tcode{true} and
5555+
\tcode{is_constructible_v<VT, initializer_list<U>\&, Args...>} is \tcode{true}.
55565556
\end{itemdescr}
55575557

55585558
\indexlibrary{\idxcode{any}!destructor}
@@ -5610,21 +5610,21 @@
56105610

56115611
\indexlibrarymember{operator=}{any}%
56125612
\begin{itemdecl}
5613-
template<class ValueType>
5614-
any& operator=(ValueType&& rhs);
5613+
template<class T>
5614+
any& operator=(T&& rhs);
56155615
\end{itemdecl}
56165616

56175617
\begin{itemdescr}
56185618
\pnum
5619-
Let \tcode{T} be \tcode{decay_t<ValueType>}.
5619+
Let \tcode{VT} be \tcode{decay_t<T>}.
56205620

56215621
\pnum
56225622
\requires
5623-
\tcode{T} shall satisfy the \tcode{CopyConstructible} requirements.
5623+
\tcode{VT} shall satisfy the \tcode{CopyConstructible} requirements.
56245624

56255625
\pnum
56265626
\effects
5627-
Constructs an object \tcode{tmp} of type \tcode{any} that contains an object of type \tcode{T} direct-initialized with \tcode{std::forward<ValueType>(rhs)}, and \tcode{tmp.swap(*this)}.
5627+
Constructs an object \tcode{tmp} of type \tcode{any} that contains an object of type \tcode{VT} direct-initialized with \tcode{std::forward<T>(rhs)}, and \tcode{tmp.swap(*this)}.
56285628
No effects if an exception is thrown.
56295629

56305630
\pnum
@@ -5646,70 +5646,70 @@
56465646

56475647
\indexlibrarymember{emplace}{any}%
56485648
\begin{itemdecl}
5649-
template <class ValueType, class... Args>
5649+
template <class T, class... Args>
56505650
void emplace(Args&&... args);
56515651
\end{itemdecl}
56525652

56535653
\begin{itemdescr}
56545654
\pnum
5655-
Let \tcode{T} be \tcode{decay_t<ValueType>}.
5655+
Let \tcode{VT} be \tcode{decay_t<T>}.
56565656

56575657
\pnum
56585658
\requires
5659-
\tcode{T} shall satisfy the \tcode{CopyConstructible} requirements.
5659+
\tcode{VT} shall satisfy the \tcode{CopyConstructible} requirements.
56605660

56615661
\pnum
56625662
\effects Calls \tcode{reset()}.
56635663
Then initializes the contained value as if direct-non-list-initializing
5664-
an object of type \tcode{T} with the arguments \tcode{std::forward<Args>(args)...}.
5664+
an object of type \tcode{VT} with the arguments \tcode{std::forward<Args>(args)...}.
56655665

56665666
\pnum
56675667
\postconditions \tcode{*this} contains a value.
56685668

56695669
\pnum
5670-
\throws Any exception thrown by the selected constructor of \tcode{T}.
5670+
\throws Any exception thrown by the selected constructor of \tcode{VT}.
56715671

56725672
\pnum
5673-
\remarks If an exception is thrown during the call to \tcode{T}'s constructor,
5673+
\remarks If an exception is thrown during the call to \tcode{VT}'s constructor,
56745674
\tcode{*this} does not contain a value, and any previously contained object
56755675
has been destroyed.
56765676
This function shall not participate in overload resolution unless
5677-
\tcode{is_copy_constructible_v<T>} is \tcode{true} and
5678-
\tcode{is_constructible_v<T, Args...>} is \tcode{true}.
5677+
\tcode{is_copy_constructible_v<VT>} is \tcode{true} and
5678+
\tcode{is_constructible_v<VT, Args...>} is \tcode{true}.
56795679
\end{itemdescr}
56805680

56815681
\indexlibrarymember{emplace}{any}%
56825682
\begin{itemdecl}
5683-
template <class ValueType, class U, class... Args>
5683+
template <class T, class U, class... Args>
56845684
void emplace(initializer_list<U> il, Args&&... args);
56855685
\end{itemdecl}
56865686

56875687
\begin{itemdescr}
56885688
\pnum
5689-
Let \tcode{T} be \tcode{decay_t<ValueType>}.
5689+
Let \tcode{VT} be \tcode{decay_t<T>}.
56905690

56915691
\pnum
56925692
\requires
5693-
\tcode{T} shall satisfy the \tcode{CopyConstructible} requirements.
5693+
\tcode{VT} shall satisfy the \tcode{CopyConstructible} requirements.
56945694

56955695
\pnum
56965696
\effects Calls \tcode{reset()}. Then initializes the contained value
5697-
as if direct-non-list-initializing an object of type \tcode{T} with the arguments
5697+
as if direct-non-list-initializing an object of type \tcode{VT} with the arguments
56985698
\tcode{il, std::forward<Args> (args)...}.
56995699

57005700
\pnum
57015701
\postconditions \tcode{*this} contains a value.
57025702

57035703
\pnum
5704-
\throws Any exception thrown by the selected constructor of \tcode{T}.
5704+
\throws Any exception thrown by the selected constructor of \tcode{VT}.
57055705

57065706
\pnum
5707-
\remarks If an exception is thrown during the call to \tcode{T}'s constructor,
5707+
\remarks If an exception is thrown during the call to \tcode{VT}'s constructor,
57085708
\tcode{*this} does not contain a value, and any previously contained object
57095709
has been destroyed.
57105710
The function shall not participate in overload resolution unless
5711-
\tcode{is_copy_constructible_v<T>} is \tcode{true} and
5712-
\tcode{is_constructible_v<T, initializer_list<U>\&, Args...>} is \tcode{true}.
5711+
\tcode{is_copy_constructible_v<VT>} is \tcode{true} and
5712+
\tcode{is_constructible_v<VT, initializer_list<U>\&, Args...>} is \tcode{true}.
57135713
\end{itemdescr}
57145714

57155715
\indexlibrarymember{reset}{any}%
@@ -5808,28 +5808,28 @@
58085808

58095809
\indexlibrary{\idxcode{any_cast}}%
58105810
\begin{itemdecl}
5811-
template<class ValueType>
5812-
ValueType any_cast(const any& operand);
5813-
template<class ValueType>
5814-
ValueType any_cast(any& operand);
5815-
template<class ValueType>
5816-
ValueType any_cast(any&& operand);
5811+
template<class T>
5812+
T any_cast(const any& operand);
5813+
template<class T>
5814+
T any_cast(any& operand);
5815+
template<class T>
5816+
T any_cast(any&& operand);
58175817
\end{itemdecl}
58185818

58195819
\begin{itemdescr}
58205820
\pnum
58215821
\requires
5822-
\tcode{is_reference_v<ValueType>} is \tcode{true} or \tcode{is_copy_constructible_v<ValueType>} is \tcode{true}.
5822+
\tcode{is_reference_v<T>} is \tcode{true} or \tcode{is_copy_constructible_v<T>} is \tcode{true}.
58235823
Otherwise the program is ill-formed.
58245824

58255825
\pnum
58265826
\returns
5827-
For the first form, \tcode{*any_cast<add_const_t<remove_reference_t<ValueType>>>(\&operand)}.
5828-
For the second and third forms, \tcode{*any_cast<remove_reference_t<ValueType>>(\&operand)}.
5827+
For the first form, \tcode{*any_cast<add_const_t<remove_reference_t<T>>>(\&operand)}.
5828+
For the second and third forms, \tcode{*any_cast<remove_reference_t<T>>(\&operand)}.
58295829

58305830
\pnum
58315831
\throws
5832-
\tcode{bad_any_cast} if \tcode{operand.type() != typeid(remove_reference_t<ValueType>)}.
5832+
\tcode{bad_any_cast} if \tcode{operand.type() != typeid(remove_reference_t<T>)}.
58335833

58345834
\pnum
58355835
\begin{example}
@@ -5863,16 +5863,16 @@
58635863

58645864
\indexlibrary{\idxcode{any_cast}}%
58655865
\begin{itemdecl}
5866-
template<class ValueType>
5867-
const ValueType* any_cast(const any* operand) noexcept;
5868-
template<class ValueType>
5869-
ValueType* any_cast(any* operand) noexcept;
5866+
template<class T>
5867+
const T* any_cast(const any* operand) noexcept;
5868+
template<class T>
5869+
T* any_cast(any* operand) noexcept;
58705870
\end{itemdecl}
58715871

58725872
\begin{itemdescr}
58735873
\pnum
58745874
\returns
5875-
If \tcode{operand != nullptr \&\& operand->type() == typeid(ValueType)},
5875+
If \tcode{operand != nullptr \&\& operand->type() == typeid(T)},
58765876
a pointer to the object contained by \tcode{operand};
58775877
otherwise, \tcode{nullptr}.
58785878

0 commit comments

Comments
 (0)