aboutsummaryrefslogtreecommitdiff
path: root/src/core/result.h
blob: a51633695bf70c08a6cd07159ac8e0fc31fca21c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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)...));
    }
}