mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-08-17 01:10:28 +03:00
AK: Let ErrorOr<T, E> expose its result/error types
`ErrorOr<T, E>::ResultType` can now refer to `T`.
This commit is contained in:
parent
c3b4b0e88b
commit
537924a8d0
Notes:
sideshowbarker
2024-07-17 20:58:35 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/537924a8d0 Pull-request: https://github.com/SerenityOS/serenity/pull/16396 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/awesomekling ✅
@ -72,9 +72,12 @@ private:
|
||||
bool m_syscall { false };
|
||||
};
|
||||
|
||||
template<typename T, typename ErrorType>
|
||||
template<typename T, typename E>
|
||||
class [[nodiscard]] ErrorOr {
|
||||
public:
|
||||
using ResultType = T;
|
||||
using ErrorType = E;
|
||||
|
||||
ErrorOr()
|
||||
requires(IsSame<T, Empty>)
|
||||
: m_value_or_error(Empty {})
|
||||
@ -146,6 +149,7 @@ private:
|
||||
template<typename ErrorType>
|
||||
class [[nodiscard]] ErrorOr<void, ErrorType> : public ErrorOr<Empty, ErrorType> {
|
||||
public:
|
||||
using ResultType = void;
|
||||
using ErrorOr<Empty, ErrorType>::ErrorOr;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user