7#define GHPL_LATEST_MSVC_VERSION_WITH_EXPECTED_BUGS 1939
8#if __has_include(<expected>) && (_MSC_VER > GHPL_LATEST_MSVC_VERSION_WITH_EXPECTED_BUGS)
13 using std::unexpected;
16 static_assert(std::is_swappable_v<std::string>);
17 static_assert(std::is_swappable_v<std::error_code>);
19#elif __has_include(<tl/expected.hpp>)
20#include <tl/expected.hpp>
26#elif defined(GHPL_EXPECTED_HEADER)
27#include GHPL_EXPECTED_HEADER
29#error "No expected implementation found"
37 template <
typename FUNC,
typename...
ARGS>
42 if constexpr (std::is_void_v<std::invoke_result_t<
FUNC,
ARGS&&...>>)
51 auto result =
func(std::forward<ARGS>(
args)...,
ec);
constexpr auto bit_count
Equal to the number of bits in the type.
Primary namespace for everything in this library.
auto call_with_expected_ec(FUNC &&func, ARGS &&... args) noexcept(noexcept(func(std::forward< ARGS >(args)...))) -> expected< std::invoke_result_t< FUNC, ARGS &&... >, std::error_code >
Calls the given function with args and an std::error_code as the last argument.