OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches

Portable from_chars for floating-point types. More...

#include <charconv>
#include <cstdlib>
#include <cstring>
#include <system_error>
#include <string>
#include <locale.h>
Include dependency graph for charconv_compat.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  openswmm
 
namespace  openswmm::detail
 

Macros

#define OPENSWMM_CHARCONV_FALLBACK   1
 

Functions

locale_t openswmm::detail::c_locale () noexcept
 Process-wide "C" locale handle for strtod_l.
 
std::from_chars_result openswmm::from_chars_double (const char *first, const char *last, double &value) noexcept
 Locale-independent parse of a double from a character range.
 

Detailed Description

Portable from_chars for floating-point types.

Apple libc++ does not support std::from_chars for floating-point types. This header provides a drop-in wrapper that uses strtod as a fallback when the standard library lacks the feature.

Every numeric token in every .inp section goes through here, so the fallback is on the hottest path in the whole load sequence — on a 500k-element model with geometry, parsing is ~80% of open(). See plans/MODEL_LOAD_INIT_OPTIMIZATION_PLAN_2026-08-12.md item 2.1.

Macro Definition Documentation

◆ OPENSWMM_CHARCONV_FALLBACK

#define OPENSWMM_CHARCONV_FALLBACK   1