Skip to content

Commit a2eeb87

Browse files
committed
backport c++23 std::expected
After studied [0], [1] and [2], I'm inclined to backport [0] to iceberg-cpp, the main reason is that [0] has exactly the same APIs as std::expected, [1] provide some extra member functions like `map` and `map_error`, [2] has different API names like `then` and `thenOrThrow`. We want users to use iceberg::expected the same way as std::expected, and we will replace iceberg::expected with std::expected when we decide to move to c++23 some day, by backporting [0], we can facilitate a smoother transition process. We discussed about `Exceptions vs Expected` in #14, while backporting [0], I had the feeling we shouldn't choose one over the other, we can use both approaches effectively. expected provide monadic operations like `and_then`, `transform`, `or_else`, `transform_error`, let us do method chaining, which is a good sign. [0] https://github.com/zeus-cpp/expected [1] https://github.com/TartanLlama/expected [2] https://github.com/facebook/folly/blob/main/folly/Expected.h [3] https://en.cppreference.com/w/cpp/utility/expected Signed-off-by: Junwang Zhao <[email protected]>
1 parent 47f636a commit a2eeb87

3 files changed

Lines changed: 2969 additions & 0 deletions

File tree

0 commit comments

Comments
 (0)