Declare the namespace-scope constants in to_chars.hpp inline (#5776)

MSVC warns with C5260 that kAlpha and kGamma have internal linkage when
the header is used as a header unit or through a module. JSON_INLINE_VARIABLE
makes them inline variables from C++17 on.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann
2026-10-07 09:03:18 +02:00
committed by GitHub
parent 24dd7c63f0
commit 30e542e52a
2 changed files with 4 additions and 4 deletions

View File

@@ -308,8 +308,8 @@ boundaries compute_boundaries(FloatType value)
//
// -e <= 60 or e >= -60 := alpha
constexpr int kAlpha = -60;
constexpr int kGamma = -32;
JSON_INLINE_VARIABLE constexpr int kAlpha = -60;
JSON_INLINE_VARIABLE constexpr int kGamma = -32;
struct cached_power // c = f * 2^e ~= 10^k
{

View File

@@ -24445,8 +24445,8 @@ boundaries compute_boundaries(FloatType value)
//
// -e <= 60 or e >= -60 := alpha
constexpr int kAlpha = -60;
constexpr int kGamma = -32;
JSON_INLINE_VARIABLE constexpr int kAlpha = -60;
JSON_INLINE_VARIABLE constexpr int kGamma = -32;
struct cached_power // c = f * 2^e ~= 10^k
{