@@ -108,7 +108,7 @@ struct is_result_error : std::false_type {};
108108 * @brief type trait for checking whether a type is derived from the ResultError class
109109 */
110110template <typename T>
111- requires std::derived_from<T, ResultError >
111+ requires std::is_base_of_v<ResultError, T >
112112struct is_result_error <T> : std::true_type {};
113113
114114/* *
@@ -121,7 +121,7 @@ inline constexpr bool is_result_error_v = is_result_error<T>::value;
121121 * @brief IsResultError concept. Enforces that the given type is derived from the ResultError class
122122 */
123123template <typename T>
124- concept IsResultError = is_result_error_v<std:: remove_cvref_t <T> >;
124+ concept IsResultError = is_result_error_v<T >;
125125
126126/* *
127127 * @brief Trait to define a "sentinel" value for types indicating an error state.
@@ -217,8 +217,8 @@ class Result {
217217 private:
218218 // helper type
219219 template <typename Self, typename F>
220- requires std::invocable<F, decltype ((std::declval<Self>().m_value ))>
221- using and_then_return_t = std::invoke_result_t <F, decltype ((std::declval<Self>().m_value ))>;
220+ requires std::invocable<F, decltype ((std::declval<Self>().value ))>
221+ using and_then_return_t = std::invoke_result_t <F, decltype ((std::declval<Self>().value ))>;
222222
223223 public:
224224 // instead of wrapping the variant in std::optional, we can use std::monostate
@@ -306,9 +306,11 @@ class Result {
306306 */
307307 template <typename Self, typename F>
308308 constexpr auto and_then (this Self&& self, F&& f)
309- requires std::invocable<F, decltype(std::forward<Self>(self).m_value )>
309+ requires std::invocable<F, decltype(std::forward<Self>(self).value )>
310310 && traits::is_result_v<and_then_return_t<Self, F>>
311- && traits::contains_all_v<and_then_return_t<Self, F>, typename Self::error_types>
311+ && traits::contains_all_v<
312+ typename and_then_return_t<Self, F>::error_types,
313+ typename Self::error_types>
312314 {
313315 // if there is an error, return said error immediately
314316 if (self.has_error ()) {
@@ -317,7 +319,7 @@ class Result {
317319 }, std::forward<Self>(self));
318320 }
319321 // otherwise, invoke the callable and return the result
320- return std::invoke (f, std::forward<Self>(self).m_value );
322+ return std::invoke (f, std::forward<Self>(self).value );
321323 }
322324
323325 constexpr operator T&() & {
@@ -440,7 +442,7 @@ class Result<void, Errs...> {
440442 }, std::forward<Self>(self));
441443 }
442444 // otherwise, invoke the callable and return the result
443- return std::invoke (f, std::forward<Self>(self).m_value );
445+ return std::invoke (f, std::forward<Self>(self).value );
444446 }
445447};
446448
0 commit comments