42 using ValueWrapperInnerType = std::conditional_t<
43 std::is_void_v<std::decay_t<ValueType>>, std::nullptr_t,
44 std::decay_t<ValueType>>;
49 typename std::enable_if_t<!std::is_void_v<std::decay_t<T1>>> * =
57 typename std::enable_if_t<std::is_void_v<std::decay_t<T1>>> * =
nullptr>
64 m_valueOrError{
other.m_valueOrError}
68 m_valueOrError{std::move(
other.m_valueOrError)}
74 m_valueOrError =
other.m_valueOrError;
83 m_valueOrError = std::move(
other.m_valueOrError);
94 return std::holds_alternative<ValueWrapper<ValueWrapperInnerType>>(
104 typename T1 = ValueType,
105 typename std::enable_if_t<!std::is_void_v<std::decay_t<T1>>> * =
107 [[nodiscard]] T1 & get()
114#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
117 ErrorString{
"Detected attempt to get value from empty Result"}};
121 return std::get<ValueWrapper<std::decay_t<ValueType>>>(m_valueOrError)
126 typename T1 = ValueType,
127 typename std::enable_if_t<!std::is_void_v<std::decay_t<T1>>> * =
129 [[nodiscard]]
const T1 & get()
const
136#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
139 ErrorString{
"Detected attempt to get value from empty Result"}};
143 return std::get<ValueWrapper<std::decay_t<ValueType>>>(m_valueOrError)
148 typename T1 = ValueType,
149 typename std::enable_if_t<!std::is_void_v<std::decay_t<T1>>> * =
151 [[nodiscard]] T1 & operator*()
157 typename T1 = ValueType,
158 typename std::enable_if_t<!std::is_void_v<std::decay_t<T1>>> * =
160 [[nodiscard]]
const T1 & operator*()
const
165 [[nodiscard]]
const ErrorType & error()
const
172#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
174 throw RuntimeError{ErrorString{
175 "Detected attempt to get error from non-empty Result"}};
179 return std::get<ErrorType>(m_valueOrError);
182 [[nodiscard]] ErrorType & error()
189#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
191 throw RuntimeError{ErrorString{
192 "Detected attempt to get error from non-empty Result"}};
196 return std::get<ErrorType>(m_valueOrError);
200 std::variant<ValueWrapper<ValueWrapperInnerType>, ErrorType> m_valueOrError;