| 6164 | |
| 6165 | template <typename value_type_> |
| 6166 | class expected { |
| 6167 | std::variant<value_type_, std::error_code> value_; |
| 6168 | |
| 6169 | public: |
| 6170 | expected(value_type_ const &value) noexcept : value_(value) {} |
| 6171 | expected(std::error_code const &error) noexcept : value_(error) {} |
| 6172 | |
| 6173 | explicit operator bool() const noexcept { return std::holds_alternative<value_type_>(value_); } |
| 6174 | value_type_ const &value() const noexcept { return std::get<value_type_>(value_); } |
| 6175 | std::error_code const &error() const noexcept { return std::get<std::error_code>(value_); } |
| 6176 | template <typename function_type_> |
| 6177 | auto and_then(function_type_ &&f) const noexcept { |
| 6178 | if (std::holds_alternative<value_type_>(value_)) return f(std::get<value_type_>(value_)); |
| 6179 | return *this; |
| 6180 | } |
| 6181 | }; |
| 6182 | |
| 6183 | static expected<std::string> read_integer_from_file_or_variants( // |
| 6184 | [[maybe_unused]] std::string const &filename, std::size_t iteration_index) noexcept { |
nothing calls this directly
no outgoing calls
no test coverage detected