|
665 | 665 | #define @\defnlibxname{cpp_lib_erase_if}@ 202002L
|
666 | 666 | // also in \libheader{string}, \libheader{deque}, \libheader{forward_list}, \libheader{list}, \libheader{vector}, \libheader{map}, \libheader{set}, \libheader{unordered_map},
|
667 | 667 | // \libheader{unordered_set}
|
| 668 | +#define @\defnlibxname{cpp_lib_exception_ptr_cast}@ 202506L // also in \libheader{exception} |
668 | 669 | #define @\defnlibxname{cpp_lib_exchange_function}@ 201304L // freestanding, also in \libheader{utility}
|
669 | 670 | #define @\defnlibxname{cpp_lib_execution}@ 201902L // also in \libheader{execution}
|
670 | 671 | #define @\defnlibxname{cpp_lib_expected}@ 202211L // also in \libheader{expected}
|
|
3864 | 3865 | constexpr exception_ptr current_exception() noexcept;
|
3865 | 3866 | [[noreturn]] constexpr void rethrow_exception(exception_ptr p);
|
3866 | 3867 | template<class E> constexpr exception_ptr make_exception_ptr(E e) noexcept;
|
| 3868 | + template<class E> const E* exception_ptr_cast(const exception_ptr& p) noexcept; |
| 3869 | + template<class E> void exception_ptr_cast(const exception_ptr&&) = delete; |
3867 | 3870 |
|
3868 | 3871 | template<class T> [[noreturn]] constexpr void throw_with_nested(T&& t);
|
3869 | 3872 | template<class E> constexpr void rethrow_if_nested(const E& e);
|
|
4143 | 4146 | For purposes of determining the presence of a data race, operations on
|
4144 | 4147 | \tcode{exception_ptr} objects shall access and modify only the
|
4145 | 4148 | \tcode{exception_ptr} objects themselves and not the exceptions they refer to.
|
4146 |
| -Use of \tcode{rethrow_exception} on \tcode{exception_ptr} objects that refer to |
| 4149 | +Use of \tcode{rethrow_exception} or \tcode{exception_ptr_cast} |
| 4150 | +on \tcode{exception_ptr} objects that refer to |
4147 | 4151 | the same exception object shall not introduce a data race.
|
4148 | 4152 | \begin{note}
|
4149 | 4153 | If
|
|
4240 | 4244 | \end{note}
|
4241 | 4245 | \end{itemdescr}
|
4242 | 4246 |
|
| 4247 | +\indexlibraryglobal{exception_ptr_cast}% |
| 4248 | +\begin{itemdecl} |
| 4249 | +template<class E> const E* exception_ptr_cast(const exception_ptr& p) noexcept; |
| 4250 | +\end{itemdecl} |
| 4251 | + |
| 4252 | +\begin{itemdescr} |
| 4253 | +\pnum |
| 4254 | +\mandates |
| 4255 | +\tcode{E} is a cv-unqualified complete object type. |
| 4256 | +\tcode{E} is not an array type. |
| 4257 | +\tcode{E} is not a pointer or pointer-to-member type. |
| 4258 | +\begin{note} |
| 4259 | +When \tcode{E} is a pointer or pointer-to-member type, |
| 4260 | +a handler of type \tcode{const E\&} can match |
| 4261 | +without binding to the exception object itself. |
| 4262 | +\end{note} |
| 4263 | + |
| 4264 | +\pnum |
| 4265 | +\returns |
| 4266 | +A pointer to the exception object referred to by \tcode{p}, |
| 4267 | +if \tcode{p} is not null and |
| 4268 | +a handler of type \tcode{const E\&} |
| 4269 | +would be a match\iref{except.handle} for that exception object. |
| 4270 | +Otherwise, \tcode{nullptr}. |
| 4271 | +\end{itemdescr} |
| 4272 | + |
4243 | 4273 | \rSec2[except.nested]{\tcode{nested_exception}}
|
4244 | 4274 |
|
4245 | 4275 | \indexlibraryglobal{nested_exception}%
|
|
0 commit comments