15 lines
419 B
C++
15 lines
419 B
C++
#pragma once
|
|||
|
|
|
||
|
|
#include <expected>
|
||
|
|
#include <string>
|
||
|
|
|
||
|
|
namespace cpp23 {
|
||
|
|
|
||
|
|
enum class ParseError { EmptyInput, InvalidNumber };
|
||
|
|
|
||
|
|
[[nodiscard]] auto parse_int(const std::string& text) -> std::expected<int, ParseError>;
|
||
|
|
[[nodiscard]] auto safe_sqrt(int value) -> std::expected<double, std::string>;
|
||
|
|
[[nodiscard]] auto chain_parse_and_double(const std::string& text) -> std::expected<int, ParseError>;
|
||
|
|
|
||
|
|
} // namespace cpp23
|