From 283d5476869410d7bcddbefaf8fe3c68f231b6df Mon Sep 17 00:00:00 2001 From: Colby Haskell Date: Sun, 5 Nov 2023 11:06:15 -0500 Subject: [PATCH] Fix EOF implicit conversion --- include/nlohmann/detail/input/input_adapters.hpp | 5 +++++ single_include/nlohmann/json.hpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/include/nlohmann/detail/input/input_adapters.hpp b/include/nlohmann/detail/input/input_adapters.hpp index 0f8d5c3c9..4ac750e8e 100644 --- a/include/nlohmann/detail/input/input_adapters.hpp +++ b/include/nlohmann/detail/input/input_adapters.hpp @@ -150,6 +150,11 @@ struct char_traits : std::char_traits { return static_cast(c); } + + static int_type eof() + { + return static_cast(EOF); + } }; // Explicitly define char traits for signed char since it is not standard diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 3b2765656..2e667b40a 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -6233,6 +6233,11 @@ struct char_traits : std::char_traits { return static_cast(c); } + + static int_type eof() + { + return static_cast(EOF); + } }; // Explicitly define char traits for signed char since it is not standard