👩💻 Join our community of thousands of amazing developers!
diff --git a/reference/expected/expected.md b/reference/expected/expected.md index 34e775ca7..b10bda892 100644 --- a/reference/expected/expected.md +++ b/reference/expected/expected.md @@ -84,19 +84,45 @@ namespace std { ## 例 ```cpp example #include <expected> +#include <iomanip> #include <iostream> +#include <string> + +// 整数除算 +std::expected<int, std::string> idiv(int a, int b) +{ + if (b == 0) { + return std::unexpected{"divide by zero"}; + } + if (a % b != 0) { + return std::une...