From 9adc5ba1f5b97e540d48db543121508c254ee697 Mon Sep 17 00:00:00 2001 From: David Markowitz Date: Sun, 7 Jun 2026 03:21:19 -0700 Subject: [PATCH] Try this for a mac definition --- dCommon/GeneralUtils.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dCommon/GeneralUtils.h b/dCommon/GeneralUtils.h index 69534b58..30be70be 100644 --- a/dCommon/GeneralUtils.h +++ b/dCommon/GeneralUtils.h @@ -243,6 +243,12 @@ namespace GeneralUtils { return std::nullopt; } + // A version of TryParse that will return `errorVal` if `str` failed to parse. + template + [[nodiscard]] T TryParse(std::string_view str, const T errorVal) { + return TryParse(str).value_or(errorVal); + } + #endif /**