Include <span> where the split moved its only use

The #2546 test case guards itself with __has_include(<span>), but the
include itself sat in unit-regression2.cpp's preamble and stayed behind,
so the section compiled without a declaration wherever the guard passed -
which nvhpc reported and libc++ builds do not, as they skip the section
altogether.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann
2026-08-21 03:19:53 +02:00
parent 02013c7f0d
commit e66a55066e
+7
View File
@@ -27,6 +27,7 @@ using json = nlohmann::json;
using ordered_json = nlohmann::ordered_json;
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <limits>
#include <string>
@@ -60,6 +61,12 @@ using ordered_json = nlohmann::ordered_json;
>;
#endif
#ifdef JSON_HAS_CPP_20
#if __has_include(<span>)
#include <span>
#endif
#endif
#if JSON_HAS_RANGES == 1
#include <ranges>
#endif