|
5338 | 5338 | template <class T, class U, class... Args>
|
5339 | 5339 | any make_any(initializer_list<U> il, Args&& ...args);
|
5340 | 5340 |
|
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); |
5347 | 5347 |
|
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; |
5352 | 5352 | }
|
5353 | 5353 | \end{codeblock}
|
5354 | 5354 |
|
|
5376 | 5376 | any(const any& other);
|
5377 | 5377 | any(any&& other) noexcept;
|
5378 | 5378 |
|
5379 |
| - template <class ValueType> any(ValueType&& value); |
| 5379 | + template <class T> any(T&& value); |
5380 | 5380 |
|
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&&...); |
5385 | 5385 |
|
5386 | 5386 | ~any();
|
5387 | 5387 |
|
5388 | 5388 | // \ref{any.assign}, assignments
|
5389 | 5389 | any& operator=(const any& rhs);
|
5390 | 5390 | any& operator=(any&& rhs) noexcept;
|
5391 | 5391 |
|
5392 |
| - template <class ValueType> any& operator=(ValueType&& rhs); |
| 5392 | + template <class T> any& operator=(T&& rhs); |
5393 | 5393 |
|
5394 | 5394 | // \ref{any.modifiers}, modifiers
|
5395 |
| - template <class ValueType, class... Args> |
| 5395 | + template <class T, class... Args> |
5396 | 5396 | void emplace(Args&& ...);
|
5397 |
| - template <class ValueType, class U, class... Args> |
| 5397 | + template <class T, class U, class... Args> |
5398 | 5398 | void emplace(initializer_list<U>, Args&&...);
|
5399 | 5399 | void reset() noexcept;
|
5400 | 5400 | void swap(any& rhs) noexcept;
|
|
5467 | 5467 |
|
5468 | 5468 | \indexlibrary{\idxcode{any}!constructor}%
|
5469 | 5469 | \begin{itemdecl}
|
5470 |
| -template<class ValueType> |
5471 |
| -any(ValueType&& value); |
| 5470 | +template<class T> |
| 5471 | +any(T&& value); |
5472 | 5472 | \end{itemdecl}
|
5473 | 5473 |
|
5474 | 5474 | \begin{itemdescr}
|
5475 | 5475 | \pnum
|
5476 |
| -Let \tcode{T} be \tcode{decay_t<ValueType>}. |
| 5476 | +Let \tcode{VT} be \tcode{decay_t<T>}. |
5477 | 5477 |
|
5478 | 5478 | \pnum
|
5479 | 5479 | \requires
|
5480 |
| -\tcode{T} shall satisfy the \tcode{CopyConstructible} requirements. |
| 5480 | +\tcode{VT} shall satisfy the \tcode{CopyConstructible} requirements. |
5481 | 5481 |
|
5482 | 5482 | \pnum
|
5483 | 5483 | \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)}. |
5485 | 5485 |
|
5486 | 5486 | \pnum
|
5487 | 5487 | \remarks
|
5488 | 5488 | 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}. |
5492 | 5492 |
|
5493 | 5493 | \pnum
|
5494 | 5494 | \throws
|
5495 |
| -Any exception thrown by the selected constructor of \tcode{T}. |
| 5495 | +Any exception thrown by the selected constructor of \tcode{VT}. |
5496 | 5496 | \end{itemdescr}
|
5497 | 5497 |
|
5498 | 5498 | \indexlibrary{\idxcode{any}!constructor}%
|
5499 | 5499 | \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); |
5502 | 5502 | \end{itemdecl}
|
5503 | 5503 |
|
5504 | 5504 | \begin{itemdescr}
|
5505 | 5505 | \pnum
|
5506 |
| -Let \tcode{T} be \tcode{decay_t<ValueType>}. |
| 5506 | +Let \tcode{VT} be \tcode{decay_t<T>}. |
5507 | 5507 |
|
5508 | 5508 | \pnum
|
5509 |
| -\requires \tcode{T} shall satisfy the \tcode{CopyConstructible} requirements. |
| 5509 | +\requires \tcode{VT} shall satisfy the \tcode{CopyConstructible} requirements. |
5510 | 5510 |
|
5511 | 5511 | \pnum
|
5512 | 5512 | \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)...}. |
5514 | 5514 |
|
5515 | 5515 | \pnum
|
5516 |
| -\postconditions \tcode{*this} contains a value of type \tcode{T}. |
| 5516 | +\postconditions \tcode{*this} contains a value of type \tcode{VT}. |
5517 | 5517 |
|
5518 | 5518 | \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}. |
5520 | 5520 |
|
5521 | 5521 | \pnum
|
5522 | 5522 | \remarks
|
5523 | 5523 | 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}. |
5526 | 5526 | \end{itemdescr}
|
5527 | 5527 |
|
5528 | 5528 | \indexlibrary{\idxcode{any}!constructor}%
|
5529 | 5529 | \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); |
5532 | 5532 | \end{itemdecl}
|
5533 | 5533 |
|
5534 | 5534 | \begin{itemdescr}
|
5535 | 5535 | \pnum
|
5536 |
| -Let \tcode{T} be \tcode{decay_t<ValueType>}. |
| 5536 | +Let \tcode{VT} be \tcode{decay_t<T>}. |
5537 | 5537 |
|
5538 | 5538 | \pnum
|
5539 |
| -\requires \tcode{T} shall satisfy the \tcode{CopyConstructible} requirements. |
| 5539 | +\requires \tcode{VT} shall satisfy the \tcode{CopyConstructible} requirements. |
5540 | 5540 |
|
5541 | 5541 | \pnum
|
5542 | 5542 | \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)...}. |
5544 | 5544 |
|
5545 | 5545 | \pnum
|
5546 | 5546 | \postconditions \tcode{*this} contains a value.
|
5547 | 5547 |
|
5548 | 5548 | \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}. |
5550 | 5550 |
|
5551 | 5551 | \pnum
|
5552 | 5552 | \remarks
|
5553 | 5553 | 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}. |
5556 | 5556 | \end{itemdescr}
|
5557 | 5557 |
|
5558 | 5558 | \indexlibrary{\idxcode{any}!destructor}
|
|
5610 | 5610 |
|
5611 | 5611 | \indexlibrarymember{operator=}{any}%
|
5612 | 5612 | \begin{itemdecl}
|
5613 |
| -template<class ValueType> |
5614 |
| -any& operator=(ValueType&& rhs); |
| 5613 | +template<class T> |
| 5614 | +any& operator=(T&& rhs); |
5615 | 5615 | \end{itemdecl}
|
5616 | 5616 |
|
5617 | 5617 | \begin{itemdescr}
|
5618 | 5618 | \pnum
|
5619 |
| -Let \tcode{T} be \tcode{decay_t<ValueType>}. |
| 5619 | +Let \tcode{VT} be \tcode{decay_t<T>}. |
5620 | 5620 |
|
5621 | 5621 | \pnum
|
5622 | 5622 | \requires
|
5623 |
| -\tcode{T} shall satisfy the \tcode{CopyConstructible} requirements. |
| 5623 | +\tcode{VT} shall satisfy the \tcode{CopyConstructible} requirements. |
5624 | 5624 |
|
5625 | 5625 | \pnum
|
5626 | 5626 | \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)}. |
5628 | 5628 | No effects if an exception is thrown.
|
5629 | 5629 |
|
5630 | 5630 | \pnum
|
|
5646 | 5646 |
|
5647 | 5647 | \indexlibrarymember{emplace}{any}%
|
5648 | 5648 | \begin{itemdecl}
|
5649 |
| -template <class ValueType, class... Args> |
| 5649 | +template <class T, class... Args> |
5650 | 5650 | void emplace(Args&&... args);
|
5651 | 5651 | \end{itemdecl}
|
5652 | 5652 |
|
5653 | 5653 | \begin{itemdescr}
|
5654 | 5654 | \pnum
|
5655 |
| -Let \tcode{T} be \tcode{decay_t<ValueType>}. |
| 5655 | +Let \tcode{VT} be \tcode{decay_t<T>}. |
5656 | 5656 |
|
5657 | 5657 | \pnum
|
5658 | 5658 | \requires
|
5659 |
| -\tcode{T} shall satisfy the \tcode{CopyConstructible} requirements. |
| 5659 | +\tcode{VT} shall satisfy the \tcode{CopyConstructible} requirements. |
5660 | 5660 |
|
5661 | 5661 | \pnum
|
5662 | 5662 | \effects Calls \tcode{reset()}.
|
5663 | 5663 | 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)...}. |
5665 | 5665 |
|
5666 | 5666 | \pnum
|
5667 | 5667 | \postconditions \tcode{*this} contains a value.
|
5668 | 5668 |
|
5669 | 5669 | \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}. |
5671 | 5671 |
|
5672 | 5672 | \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, |
5674 | 5674 | \tcode{*this} does not contain a value, and any previously contained object
|
5675 | 5675 | has been destroyed.
|
5676 | 5676 | 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}. |
5679 | 5679 | \end{itemdescr}
|
5680 | 5680 |
|
5681 | 5681 | \indexlibrarymember{emplace}{any}%
|
5682 | 5682 | \begin{itemdecl}
|
5683 |
| -template <class ValueType, class U, class... Args> |
| 5683 | +template <class T, class U, class... Args> |
5684 | 5684 | void emplace(initializer_list<U> il, Args&&... args);
|
5685 | 5685 | \end{itemdecl}
|
5686 | 5686 |
|
5687 | 5687 | \begin{itemdescr}
|
5688 | 5688 | \pnum
|
5689 |
| -Let \tcode{T} be \tcode{decay_t<ValueType>}. |
| 5689 | +Let \tcode{VT} be \tcode{decay_t<T>}. |
5690 | 5690 |
|
5691 | 5691 | \pnum
|
5692 | 5692 | \requires
|
5693 |
| -\tcode{T} shall satisfy the \tcode{CopyConstructible} requirements. |
| 5693 | +\tcode{VT} shall satisfy the \tcode{CopyConstructible} requirements. |
5694 | 5694 |
|
5695 | 5695 | \pnum
|
5696 | 5696 | \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 |
5698 | 5698 | \tcode{il, std::forward<Args> (args)...}.
|
5699 | 5699 |
|
5700 | 5700 | \pnum
|
5701 | 5701 | \postconditions \tcode{*this} contains a value.
|
5702 | 5702 |
|
5703 | 5703 | \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}. |
5705 | 5705 |
|
5706 | 5706 | \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, |
5708 | 5708 | \tcode{*this} does not contain a value, and any previously contained object
|
5709 | 5709 | has been destroyed.
|
5710 | 5710 | 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}. |
5713 | 5713 | \end{itemdescr}
|
5714 | 5714 |
|
5715 | 5715 | \indexlibrarymember{reset}{any}%
|
|
5808 | 5808 |
|
5809 | 5809 | \indexlibrary{\idxcode{any_cast}}%
|
5810 | 5810 | \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); |
5817 | 5817 | \end{itemdecl}
|
5818 | 5818 |
|
5819 | 5819 | \begin{itemdescr}
|
5820 | 5820 | \pnum
|
5821 | 5821 | \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}. |
5823 | 5823 | Otherwise the program is ill-formed.
|
5824 | 5824 |
|
5825 | 5825 | \pnum
|
5826 | 5826 | \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)}. |
5829 | 5829 |
|
5830 | 5830 | \pnum
|
5831 | 5831 | \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>)}. |
5833 | 5833 |
|
5834 | 5834 | \pnum
|
5835 | 5835 | \begin{example}
|
|
5863 | 5863 |
|
5864 | 5864 | \indexlibrary{\idxcode{any_cast}}%
|
5865 | 5865 | \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; |
5870 | 5870 | \end{itemdecl}
|
5871 | 5871 |
|
5872 | 5872 | \begin{itemdescr}
|
5873 | 5873 | \pnum
|
5874 | 5874 | \returns
|
5875 |
| -If \tcode{operand != nullptr \&\& operand->type() == typeid(ValueType)}, |
| 5875 | +If \tcode{operand != nullptr \&\& operand->type() == typeid(T)}, |
5876 | 5876 | a pointer to the object contained by \tcode{operand};
|
5877 | 5877 | otherwise, \tcode{nullptr}.
|
5878 | 5878 |
|
|
0 commit comments