#pragma once #include #include constexpr uint32_t NUMBER_BASE = 10U; template class ConversionResult { public: explicit ConversionResult(const bool &success_, const ResultType &result_, const std::string_view &fail_reason_ = "") : success(success_), result(result_), fail_reason(fail_reason_) { } const bool &success; const ResultType &result; const std::string_view &fail_reason; }; static constexpr auto IS_VALID_UINT = ctll::fixed_string("^[0-9]+$"); static constexpr auto IS_UINT_IN_RANGE = ctll::fixed_string("^[0-9]{1,19}$"); /** * Converts a string to a uint32_teger. * * @param str A string that possibly is a uint32_teger * @returns A conversion result */ ConversionResult str_to_uint(const std::string_view &str);