|
4469 | 4469 | template<class T> |
4470 | 4470 | class optional<T&> { |
4471 | 4471 | public: |
4472 | | - using value_type = T; |
4473 | | - using iterator = @\impdefnc@; // see~\ref{optional.ref.iterators} |
| 4472 | + using value_type = T; |
| 4473 | + using iterator = @\impdefnc@; // present only if \tcode{T} is an object type other than an array |
| 4474 | + // of unknown bound; see~\ref{optional.ref.iterators} |
4474 | 4475 |
|
4475 | 4476 | public: |
4476 | 4477 | // \ref{optional.ref.ctor}, constructors |
|
4503 | 4504 | constexpr void swap(optional& rhs) noexcept; |
4504 | 4505 |
|
4505 | 4506 | // \ref{optional.ref.iterators}, iterator support |
4506 | | - constexpr iterator begin() const noexcept; |
4507 | | - constexpr iterator end() const noexcept; |
| 4507 | + constexpr auto begin() const noexcept; |
| 4508 | + constexpr auto end() const noexcept; |
4508 | 4509 |
|
4509 | 4510 | // \ref{optional.ref.observe}, observers |
4510 | 4511 | constexpr T* operator->() const noexcept; |
|
4778 | 4779 | \rSec3[optional.ref.iterators]{Iterator support} |
4779 | 4780 |
|
4780 | 4781 | \begin{itemdecl} |
4781 | | -using iterator = @\impdef@; |
| 4782 | +using iterator = @\impdefnc@; // present only if \tcode{T} is an object type other than an array |
| 4783 | + // of unknown bound |
4782 | 4784 | \end{itemdecl} |
4783 | 4785 |
|
4784 | 4786 | \begin{itemdescr} |
|
4796 | 4798 | \end{itemdescr} |
4797 | 4799 |
|
4798 | 4800 | \begin{itemdecl} |
4799 | | -constexpr iterator begin() const noexcept; |
| 4801 | +constexpr auto begin() const noexcept; |
4800 | 4802 | \end{itemdecl} |
4801 | 4803 |
|
4802 | 4804 | \begin{itemdescr} |
| 4805 | +\pnum |
| 4806 | +\constraints |
| 4807 | +\tcode{T} is an object type other than an array of unknown bound. |
| 4808 | + |
4803 | 4809 | \pnum |
4804 | 4810 | \returns |
4805 | | - If \tcode{has_value()} is \tcode{true}, |
4806 | | - an iterator referring to \tcode{*\exposid{val}}. |
4807 | | - Otherwise, a past-the-end iterator value. |
| 4811 | + An object \tcode{i} of type \tcode{iterator}, such that |
| 4812 | + \tcode{i} is an iterator referring to \tcode{*\exposid{val}} |
| 4813 | + if \tcode{has_value()} is \tcode{true}, and |
| 4814 | + a past-the-end iterator value otherwise. |
4808 | 4815 | \end{itemdescr} |
4809 | 4816 |
|
4810 | 4817 | \begin{itemdecl} |
4811 | | -constexpr iterator end() const noexcept; |
| 4818 | +constexpr auto end() const noexcept; |
4812 | 4819 | \end{itemdecl} |
4813 | 4820 |
|
4814 | 4821 | \begin{itemdescr} |
| 4822 | +\pnum |
| 4823 | +\constraints |
| 4824 | +\tcode{T} is an object type other than an array of unknown bound. |
| 4825 | + |
4815 | 4826 | \pnum |
4816 | 4827 | \returns |
4817 | 4828 | \tcode{begin() + has_value()}. |
|
0 commit comments