It's a shame that sum type support is still so lacking in C++. Proper Result
types (ala Haskell or Rust) are generally much nicer to deal with, especially in embedded contexts.
As is, there's only std::expected
(which can and will blow up in your face if you forget to check has_value
) and std::variant
, which I have heard nothing but complaints about.