Use json::with_integers_t in the test and the docs

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann committed 2026-10-13 18:57:59 +02:00
1 parent 45b837885e
commit 735a20e36d
2 files changed
+3 -4

No files matched your search

@@ -521,8 +521,8 @@ therefore silently changes parse results rather than raising an error. See
#### Same type for both
`NumberUnsignedType` may be the same type as `NumberIntegerType`, e.g.
`#!cpp basic_json<std::map, std::vector, std::string, bool, std::int64_t, std::int64_t, double>`, for code that only
wants to handle one integer type. Such a `basic_json` stores every integer as
`#!cpp nlohmann::json::with_integers_t<std::int64_t, std::int64_t>` (see
[`with_integers_t`](../../api/basic_json/with_t.md)), for code that only wants to handle one integer type. Such a `basic_json` stores every integer as
[`number_integer_t`](../../api/basic_json/number_integer_t.md):
- [`is_number_unsigned()`](../../api/basic_json/is_number_unsigned.md) is always `#!cpp false`, and
+1 -2
View File
@@ -13,7 +13,6 @@
#include <cstdint>
#include <functional>
#include <limits>
#include <map>
#include <string>
#include <vector>
@@ -24,7 +23,7 @@ namespace
{
template<typename IntegerType>
using same_types_json = nlohmann::basic_json<std::map, std::vector, std::string, bool, IntegerType, IntegerType, double>;
using same_types_json = nlohmann::json::with_integers_t<IntegerType, IntegerType>;
using json64 = same_types_json<std::int64_t>;
using json32 = same_types_json<std::int32_t>;