File indexing completed on 2026-05-03 08:13:37
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef _LIBCPP___CXX03___PSTL_HANDLE_EXCEPTION_H
0010 #define _LIBCPP___CXX03___PSTL_HANDLE_EXCEPTION_H
0011
0012 #include <__cxx03/__config>
0013 #include <__cxx03/__utility/forward.h>
0014 #include <__cxx03/__utility/move.h>
0015 #include <__cxx03/new> // __throw_bad_alloc
0016 #include <__cxx03/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 <__cxx03/__undef_macros>
0024
0025 _LIBCPP_BEGIN_NAMESPACE_STD
0026 namespace __pstl {
0027
0028 template <class _BackendFunction, class... _Args>
0029 _LIBCPP_HIDE_FROM_ABI auto __handle_exception_impl(_Args&&... __args) noexcept {
0030 return _BackendFunction{}(std::forward<_Args>(__args)...);
0031 }
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043 template <class _BackendFunction, class... _Args>
0044 _LIBCPP_HIDE_FROM_ABI auto __handle_exception(_Args&&... __args) {
0045 auto __result = __pstl::__handle_exception_impl<_BackendFunction>(std::forward<_Args>(__args)...);
0046 if (__result == nullopt)
0047 std::__throw_bad_alloc();
0048 else
0049 return std::move(*__result);
0050 }
0051
0052 }
0053 _LIBCPP_END_NAMESPACE_STD
0054
0055 _LIBCPP_POP_MACROS
0056
0057 #endif