Try this for a mac definition

This commit is contained in:
David Markowitz
2026-06-07 03:21:19 -07:00
parent e5ab06e97f
commit 9adc5ba1f5

View File

@@ -243,6 +243,12 @@ namespace GeneralUtils {
return std::nullopt;
}
// A version of TryParse that will return `errorVal` if `str` failed to parse.
template <std::floating_point T>
[[nodiscard]] T TryParse(std::string_view str, const T errorVal) {
return TryParse<T>(str).value_or(errorVal);
}
#endif
/**