Skip to content

Commit

Permalink
Fix signed char char traits
Browse files Browse the repository at this point in the history
  • Loading branch information
colbychaskell committed Nov 5, 2023
1 parent 24e9f2d commit def726f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions include/nlohmann/detail/input/input_adapters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,18 @@ template<>
struct char_traits<signed char> : std::char_traits<char>
{
using char_type = signed char;
using int_type = unsigned long;

// Redefine to_int_type function
static int_type to_int_type(char_type c)
{
return static_cast<int_type>(c);
}

static int_type eof()
{
return static_cast<int_type>(EOF);
}
};

// General-purpose iterator-based adapter. It might not be as fast as
Expand Down
12 changes: 12 additions & 0 deletions single_include/nlohmann/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6239,6 +6239,18 @@ template<>
struct char_traits<signed char> : std::char_traits<char>
{
using char_type = signed char;
using int_type = unsigned long;

// Redefine to_int_type function
static int_type to_int_type(char_type c)
{
return static_cast<int_type>(c);
}

static int_type eof()
{
return static_cast<int_type>(EOF);
}
};

// General-purpose iterator-based adapter. It might not be as fast as
Expand Down

0 comments on commit def726f

Please sign in to comment.