Skip to content

Commit 1c50d24

Browse files
committed
Fix char_int_type in lexer
1 parent fba40f9 commit 1c50d24

File tree

2 files changed

+61
-58
lines changed

2 files changed

+61
-58
lines changed

include/nlohmann/detail/input/lexer.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <nlohmann/detail/input/input_adapters.hpp>
2222
#include <nlohmann/detail/input/position_t.hpp>
2323
#include <nlohmann/detail/macro_scope.hpp>
24+
#include <nlohmann/detail/meta/type_traits.hpp>
2425

2526
NLOHMANN_JSON_NAMESPACE_BEGIN
2627
namespace detail
@@ -115,7 +116,7 @@ class lexer : public lexer_base<BasicJsonType>
115116
using number_float_t = typename BasicJsonType::number_float_t;
116117
using string_t = typename BasicJsonType::string_t;
117118
using char_type = typename InputAdapterType::char_type;
118-
using char_int_type = typename std::char_traits<char_type>::int_type;
119+
using char_int_type = typename char_traits<char_type>::int_type;
119120

120121
public:
121122
using token_type = typename lexer_base<BasicJsonType>::token_type;

single_include/nlohmann/json.hpp

Lines changed: 59 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -3360,71 +3360,71 @@ NLOHMANN_JSON_NAMESPACE_END
33603360
// SPDX-License-Identifier: MIT
33613361

33623362
#ifndef INCLUDE_NLOHMANN_JSON_FWD_HPP_
3363-
#define INCLUDE_NLOHMANN_JSON_FWD_HPP_
3363+
#define INCLUDE_NLOHMANN_JSON_FWD_HPP_
33643364

3365-
#include <cstdint> // int64_t, uint64_t
3366-
#include <map> // map
3367-
#include <memory> // allocator
3368-
#include <string> // string
3369-
#include <vector> // vector
3365+
#include <cstdint> // int64_t, uint64_t
3366+
#include <map> // map
3367+
#include <memory> // allocator
3368+
#include <string> // string
3369+
#include <vector> // vector
33703370

3371-
// #include <nlohmann/detail/abi_macros.hpp>
3371+
// #include <nlohmann/detail/abi_macros.hpp>
33723372

33733373

3374-
/*!
3375-
@brief namespace for Niels Lohmann
3376-
@see https://github.com/nlohmann
3377-
@since version 1.0.0
3378-
*/
3379-
NLOHMANN_JSON_NAMESPACE_BEGIN
3374+
/*!
3375+
@brief namespace for Niels Lohmann
3376+
@see https://github.com/nlohmann
3377+
@since version 1.0.0
3378+
*/
3379+
NLOHMANN_JSON_NAMESPACE_BEGIN
33803380

3381-
/*!
3382-
@brief default JSONSerializer template argument
3381+
/*!
3382+
@brief default JSONSerializer template argument
33833383

3384-
This serializer ignores the template arguments and uses ADL
3385-
([argument-dependent lookup](https://en.cppreference.com/w/cpp/language/adl))
3386-
for serialization.
3387-
*/
3388-
template<typename T = void, typename SFINAE = void>
3389-
struct adl_serializer;
3390-
3391-
/// a class to store JSON values
3392-
/// @sa https://json.nlohmann.me/api/basic_json/
3393-
template<template<typename U, typename V, typename... Args> class ObjectType =
3394-
std::map,
3395-
template<typename U, typename... Args> class ArrayType = std::vector,
3396-
class StringType = std::string, class BooleanType = bool,
3397-
class NumberIntegerType = std::int64_t,
3398-
class NumberUnsignedType = std::uint64_t,
3399-
class NumberFloatType = double,
3400-
template<typename U> class AllocatorType = std::allocator,
3401-
template<typename T, typename SFINAE = void> class JSONSerializer =
3402-
adl_serializer,
3403-
class BinaryType = std::vector<std::uint8_t>, // cppcheck-suppress syntaxError
3404-
class CustomBaseClass = void>
3405-
class basic_json;
3406-
3407-
/// @brief JSON Pointer defines a string syntax for identifying a specific value within a JSON document
3408-
/// @sa https://json.nlohmann.me/api/json_pointer/
3409-
template<typename RefStringType>
3410-
class json_pointer;
3384+
This serializer ignores the template arguments and uses ADL
3385+
([argument-dependent lookup](https://en.cppreference.com/w/cpp/language/adl))
3386+
for serialization.
3387+
*/
3388+
template<typename T = void, typename SFINAE = void>
3389+
struct adl_serializer;
3390+
3391+
/// a class to store JSON values
3392+
/// @sa https://json.nlohmann.me/api/basic_json/
3393+
template<template<typename U, typename V, typename... Args> class ObjectType =
3394+
std::map,
3395+
template<typename U, typename... Args> class ArrayType = std::vector,
3396+
class StringType = std::string, class BooleanType = bool,
3397+
class NumberIntegerType = std::int64_t,
3398+
class NumberUnsignedType = std::uint64_t,
3399+
class NumberFloatType = double,
3400+
template<typename U> class AllocatorType = std::allocator,
3401+
template<typename T, typename SFINAE = void> class JSONSerializer =
3402+
adl_serializer,
3403+
class BinaryType = std::vector<std::uint8_t>, // cppcheck-suppress syntaxError
3404+
class CustomBaseClass = void>
3405+
class basic_json;
34113406

3412-
/*!
3413-
@brief default specialization
3414-
@sa https://json.nlohmann.me/api/json/
3415-
*/
3416-
using json = basic_json<>;
3407+
/// @brief JSON Pointer defines a string syntax for identifying a specific value within a JSON document
3408+
/// @sa https://json.nlohmann.me/api/json_pointer/
3409+
template<typename RefStringType>
3410+
class json_pointer;
34173411

3418-
/// @brief a minimal map-like container that preserves insertion order
3419-
/// @sa https://json.nlohmann.me/api/ordered_map/
3420-
template<class Key, class T, class IgnoredLess, class Allocator>
3421-
struct ordered_map;
3412+
/*!
3413+
@brief default specialization
3414+
@sa https://json.nlohmann.me/api/json/
3415+
*/
3416+
using json = basic_json<>;
3417+
3418+
/// @brief a minimal map-like container that preserves insertion order
3419+
/// @sa https://json.nlohmann.me/api/ordered_map/
3420+
template<class Key, class T, class IgnoredLess, class Allocator>
3421+
struct ordered_map;
34223422

3423-
/// @brief specialization that maintains the insertion order of object keys
3424-
/// @sa https://json.nlohmann.me/api/ordered_json/
3425-
using ordered_json = basic_json<nlohmann::ordered_map>;
3423+
/// @brief specialization that maintains the insertion order of object keys
3424+
/// @sa https://json.nlohmann.me/api/ordered_json/
3425+
using ordered_json = basic_json<nlohmann::ordered_map>;
34263426

3427-
NLOHMANN_JSON_NAMESPACE_END
3427+
NLOHMANN_JSON_NAMESPACE_END
34283428

34293429
#endif // INCLUDE_NLOHMANN_JSON_FWD_HPP_
34303430

@@ -7375,6 +7375,8 @@ NLOHMANN_JSON_NAMESPACE_END
73757375

73767376
// #include <nlohmann/detail/macro_scope.hpp>
73777377

7378+
// #include <nlohmann/detail/meta/type_traits.hpp>
7379+
73787380

73797381
NLOHMANN_JSON_NAMESPACE_BEGIN
73807382
namespace detail
@@ -7469,7 +7471,7 @@ class lexer : public lexer_base<BasicJsonType>
74697471
using number_float_t = typename BasicJsonType::number_float_t;
74707472
using string_t = typename BasicJsonType::string_t;
74717473
using char_type = typename InputAdapterType::char_type;
7472-
using char_int_type = typename std::char_traits<char_type>::int_type;
7474+
using char_int_type = typename char_traits<char_type>::int_type;
74737475

74747476
public:
74757477
using token_type = typename lexer_base<BasicJsonType>::token_type;
@@ -19410,7 +19412,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
1941019412
detail::parser_callback_t<basic_json>cb = nullptr,
1941119413
const bool allow_exceptions = true,
1941219414
const bool ignore_comments = false
19413-
)
19415+
)
1941419416
{
1941519417
return ::nlohmann::detail::parser<basic_json, InputAdapterType>(std::move(adapter),
1941619418
std::move(cb), allow_exceptions, ignore_comments);

0 commit comments

Comments
 (0)