aboutsummaryrefslogtreecommitdiff
path: root/src/core/result.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/result.h')
-rw-r--r--src/core/result.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/core/result.h b/src/core/result.h
new file mode 100644
index 0000000..a516336
--- /dev/null
+++ b/src/core/result.h
@@ -0,0 +1,18 @@
+#pragma once
+
+#include <expected>
+#include <format>
+#include <string>
+#include <utility>
+
+namespace Hsdbg
+{
+ template <typename T>
+ using Result = std::expected<T, std::string>;
+
+ template <typename... Args>
+ auto fail(std::format_string<Args...> fmt, Args&&... args) -> std::unexpected<std::string>
+ {
+ return std::unexpected(std::format(fmt, std::forward<Args>(args)...));
+ }
+}