17#if defined(__cpp_lib_expected) && __cpp_lib_expected >= 202202L
44 return static_cast<std::int32_t
>(r) >= 0;
49 return static_cast<std::int32_t
>(r) < 0;
56 const char* name =
nullptr;
61#if defined(__cpp_lib_expected) && __cpp_lib_expected >= 202202L
64using expected = std::expected<T, result>;
66using unexpected = std::unexpected<result>;
88 static_assert(std::is_default_constructible_v<T>,
89 "vgl::expected requires a default-constructible type");
92 constexpr expected(
T value)
noexcept(std::is_nothrow_move_constructible_v<T>)
126 value.struct_size =
static_cast<std::uint32_t
>(
sizeof(
T));
141 static_cast<void>(
vgl_version_get(&
v.major_version, &
v.minor_version, &
v.patch_version));
vgl_result
Definition base.h:98
@ VGL_RESULT_IO_ERROR
Definition base.h:117
@ VGL_RESULT_SUCCESS
Definition base.h:100
@ VGL_RESULT_VERSION_MISMATCH
Definition base.h:121
@ VGL_RESULT_CORRUPT_DATA
Definition base.h:119
@ VGL_RESULT_OUT_OF_MEMORY
Definition base.h:109
@ VGL_RESULT_NOT_READY
Definition base.h:105
@ VGL_RESULT_NOT_FOUND
Definition base.h:115
@ VGL_RESULT_INVALID_OPERATION
Definition base.h:113
@ VGL_RESULT_INVALID_ARGUMENT
Definition base.h:107
@ VGL_RESULT_CANCELLED
Definition base.h:123
@ VGL_RESULT_INTERNAL_ERROR
Definition base.h:127
@ VGL_RESULT_NOT_SUPPORTED
Definition base.h:111
@ VGL_RESULT_INCOMPLETE
Definition base.h:102
@ VGL_RESULT_BACKEND_ERROR
Definition base.h:125
vgl_result vgl_version_get(uint32_t *out_major, uint32_t *out_minor, uint32_t *out_patch)
vgl_result vgl_result_name_get(vgl_result result, const char **out_name)
constexpr const T & operator*() const &noexcept
Definition base.hpp:107
constexpr const T & value() const &noexcept
Definition base.hpp:103
constexpr T & operator*() &noexcept
Definition base.hpp:106
constexpr expected(unexpected error) noexcept
Definition base.hpp:97
constexpr const T * operator->() const noexcept
Definition base.hpp:109
constexpr T && value() &&noexcept
Definition base.hpp:104
constexpr bool has_value() const noexcept
Definition base.hpp:99
constexpr result error() const noexcept
Definition base.hpp:111
constexpr T & value() &noexcept
Definition base.hpp:102
constexpr expected(T value) noexcept(std::is_nothrow_move_constructible_v< T >)
Definition base.hpp:92
constexpr T * operator->() noexcept
Definition base.hpp:108
constexpr result error() const noexcept
Definition base.hpp:76
constexpr unexpected(result error) noexcept
Definition base.hpp:74
result
Definition base.hpp:25
constexpr T init() noexcept
Definition base.hpp:123
const char * result_name_get(result r) noexcept
Definition base.hpp:54
version version_get() noexcept
Definition base.hpp:138
constexpr bool succeeded(result r) noexcept
Definition base.hpp:42
std::uint32_t patch_version
Definition base.hpp:134
std::uint32_t major_version
Definition base.hpp:132
std::uint32_t minor_version
Definition base.hpp:133