|
|
|
|
|
by adastra22
1064 days ago
|
|
This is essentially "Rust's error handling in C++", no? I generally think this is an improvement and good to have, but I'm wondering if there are any hidden differences. The C++ standard library already exposes a std::optional type. Does this stx::Option type differ from that one? |
|
std::optional is a stack pointer, like other C++ pointers you can straight up deref’ it and get an UB.
It looks like stx::Option is an actually option type, it focuses on safety and will throw if “unsafe” methods are called on the wrong state. It also provides a slew of monadic operators to operate over values.