Skip to content

Commit a6e0d97

Browse files
committed
Fix macOS build: replace std::to_chars(float) with snprintf
std::to_chars for floating point is unavailable on macOS with older SDKs (requires macOS 13.3+), breaking conda-forge builds.
1 parent b1dbe1c commit a6e0d97

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/Tesselator/ShapeTesselator.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
#include "ShapeTesselator.h"
1919

2020
#include <algorithm>
21-
#include <charconv>
2221
#include <cmath>
22+
#include <cstdio>
2323
#include <cstring>
2424
#include <fstream>
2525
#include <iostream>
@@ -54,15 +54,15 @@
5454
#include <TColStd_Array1OfInteger.hxx>
5555

5656
// ========================================================================
57-
// Fast float-to-string helpers using C++17 std::to_chars
57+
// Fast float-to-string helpers
5858
// ========================================================================
5959

6060
namespace {
61-
//! Append a float to a string using std::to_chars (no locale, no virtual dispatch)
61+
//! Append a float to a string using snprintf (portable across all platforms)
6262
inline void appendFloat(std::string& out, float f) {
6363
char buf[32];
64-
auto [ptr, ec] = std::to_chars(buf, buf + sizeof(buf), f);
65-
out.append(buf, static_cast<size_t>(ptr - buf));
64+
int len = std::snprintf(buf, sizeof(buf), "%g", f);
65+
out.append(buf, static_cast<size_t>(len));
6666
}
6767

6868
//! Append a float with epsilon clamping (for X3D export compatibility)

0 commit comments

Comments
 (0)