2 недели назад
История
README.md
fusion
Exception-free error handling library.
Example
#include <fusion/result.h>
#include <iostream>
auto divide(const int a, const int b) -> sz::result<int, std::invalid_argument> {
if (a == 0 || b == 0) {
return std::invalid_argument{"divide by zero"};
}
return a / b;
}
int main() {
if (auto result = divide(64, 8); result.has_value()) {
std::cout << "64 / 8 = " << result.get() << std::endl;
} else {
std::cerr << "error: " << result.get_error().what() << std::endl;
}
return 0;
}
Конвейеры
0 успешных
0 с ошибкой