C++ “result” type based on modern languages like Swift and Rust
github.comHey everyone, I created a C++ "`result`" monad type with functionalities and behaviours much like Swift or Rust's equivalent `Result` type.
I've been working on this project for quite some time, and just wanted to share it with everyone because it's at a point that i feel is complete for a 1.0 release.
A little bit about it:
It's completely zero-overhead (no paying for what you don't use), constexpr supported, C++11 compatible (with more constexpr in newer versions), it optimizes extremely well (https://godbolt.org/z/TsonT1), it's extremely well-tested (https://coveralls.io/github/bitwizeshift/result?branch=maste...) both for static validation and runtime validation, and despite being based on the feature-sets from other modern languages, the design has kept a focus on keeping this idiomatic for modern C++
The design was originally based on the P0323 `std::expected` proposals, and over time grew into a standalone type that better modelled `result` in the end.