1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- #ifndef BOOST_OUTCOME_EXPERIMENTAL_COROUTINE_SUPPORT_HPP
- #define BOOST_OUTCOME_EXPERIMENTAL_COROUTINE_SUPPORT_HPP
- #include "../config.hpp"
- #define BOOST_OUTCOME_COROUTINE_SUPPORT_NAMESPACE_BEGIN \
- BOOST_OUTCOME_V2_NAMESPACE_BEGIN namespace experimental \
- { \
- namespace awaitables \
- {
- #define BOOST_OUTCOME_COROUTINE_SUPPORT_NAMESPACE_EXPORT_BEGIN \
- BOOST_OUTCOME_V2_NAMESPACE_EXPORT_BEGIN namespace experimental \
- { \
- namespace awaitables \
- {
- #define BOOST_OUTCOME_COROUTINE_SUPPORT_NAMESPACE_END \
- } \
- } \
- BOOST_OUTCOME_V2_NAMESPACE_END
- #ifndef BOOST_NO_EXCEPTIONS
- #if !BOOST_OUTCOME_USE_SYSTEM_STATUS_CODE && __has_include("status-code/system_code_from_exception.hpp")
- #include "status-code/system_code_from_exception.hpp"
- #else
- #include <status-code/system_code_from_exception.hpp>
- #endif
- BOOST_OUTCOME_V2_NAMESPACE_BEGIN
- namespace awaitables
- {
- namespace detail
- {
- inline bool error_is_set(BOOST_OUTCOME_SYSTEM_ERROR2_NAMESPACE::system_code &sc) noexcept { return sc.failure(); }
- inline BOOST_OUTCOME_SYSTEM_ERROR2_NAMESPACE::system_code error_from_exception(std::exception_ptr &&ep = std::current_exception(), BOOST_OUTCOME_SYSTEM_ERROR2_NAMESPACE::system_code not_matched = BOOST_OUTCOME_SYSTEM_ERROR2_NAMESPACE::generic_code(BOOST_OUTCOME_SYSTEM_ERROR2_NAMESPACE::errc::resource_unavailable_try_again)) noexcept
- {
- return BOOST_OUTCOME_SYSTEM_ERROR2_NAMESPACE::system_code_from_exception(static_cast<std::exception_ptr &&>(ep), static_cast<BOOST_OUTCOME_SYSTEM_ERROR2_NAMESPACE::system_code &&>(not_matched));
- }
- }
- }
- BOOST_OUTCOME_V2_NAMESPACE_END
- #endif
- #include "../detail/coroutine_support.ipp"
- #undef BOOST_OUTCOME_COROUTINE_SUPPORT_NAMESPACE_BEGIN
- #undef BOOST_OUTCOME_COROUTINE_SUPPORT_NAMESPACE_EXPORT_BEGIN
- #undef BOOST_OUTCOME_COROUTINE_SUPPORT_NAMESPACE_END
- #endif
|