/Result.cpp

Result type for C++ inspired by Rust.

Primary LanguageC++OtherNOASSERTION

Result.cpp

Build Status

Rusult type for C++ inspired by Rust.

WIP

Usage

You can just take header lib/result.hpp and place it into your project

#include <iostream>

#include "result.hpp"

decltype(auto) get_something() {
    //Do some work.

    return result::Result<int, std::string>::ok(1);
}

int main() {
    const auto result = get_something();

    std::cout << "Result=" << result.unwrap_or(0) << "\n";