Monadic Operations for Box-Like Types

C++23 gave std::optional and std::expected monadic operations – and_then, transform, or_else and transform_error for std::expected. The pattern is clearly useful. But it is not extensible: every type that wants to participate must wait for the committee to add member functions. std::unique_ptr, raw owning pointers, third-party expected types, user-defined result wrappers – none of them participate … Continue reading Monadic Operations for Box-Like Types