File indexing completed on 2026-05-03 08:13:59
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef _LIBCPP___PSTL_HANDLE_EXCEPTION_H
0010 #define _LIBCPP___PSTL_HANDLE_EXCEPTION_H
0011
0012 #include <__config>
0013 #include <__new/exceptions.h>
0014 #include <__utility/forward.h>
0015 #include <__utility/move.h>
0016 #include <optional>
0017
0018 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0019 # pragma GCC system_header
0020 #endif
0021
0022 _LIBCPP_PUSH_MACROS
0023 #include <__undef_macros>
0024
0025 #if _LIBCPP_STD_VER >= 17
0026
0027 _LIBCPP_BEGIN_NAMESPACE_STD
0028 namespace __pstl {
0029
0030 template <class _BackendFunction, class... _Args>
0031 _LIBCPP_HIDE_FROM_ABI auto __handle_exception_impl(_Args&&... __args) noexcept {
0032 return _BackendFunction{}(std::forward<_Args>(__args)...);
0033 }
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045 template <class _BackendFunction, class... _Args>
0046 _LIBCPP_HIDE_FROM_ABI auto __handle_exception(_Args&&... __args) {
0047 auto __result = __pstl::__handle_exception_impl<_BackendFunction>(std::forward<_Args>(__args)...);
0048 if (__result == nullopt)
0049 std::__throw_bad_alloc();
0050 else
0051 return std::move(*__result);
0052 }
0053
0054 }
0055 _LIBCPP_END_NAMESPACE_STD
0056
0057 #endif
0058
0059 _LIBCPP_POP_MACROS
0060
0061 #endif