From ae213721b1d51570f8d922c8b3f7a7fa13ccdbdf Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sun, 6 May 2018 14:05:29 +0200 Subject: [PATCH] :hammer: removed unget function for wstring parsers --- .../nlohmann/detail/input/input_adapters.hpp | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/include/nlohmann/detail/input/input_adapters.hpp b/include/nlohmann/detail/input/input_adapters.hpp index 6a3ffa2b..d1c7fea1 100644 --- a/include/nlohmann/detail/input/input_adapters.hpp +++ b/include/nlohmann/detail/input/input_adapters.hpp @@ -123,13 +123,6 @@ class wide_string_input_adapter : public input_adapter_protocol std::char_traits::int_type get_character() noexcept override { - // unget_character() was called previously: return the last character - if (next_unget) - { - next_unget = false; - return last_char; - } - // check if buffer needs to be filled if (utf8_bytes_index == utf8_bytes_filled) { @@ -149,12 +142,7 @@ class wide_string_input_adapter : public input_adapter_protocol // use buffer assert(utf8_bytes_filled > 0); assert(utf8_bytes_index < utf8_bytes_filled); - return (last_char = utf8_bytes[utf8_bytes_index++]); - } - - void unget_character() noexcept override - { - next_unget = true; + return utf8_bytes[utf8_bytes_index++]; } private: @@ -278,11 +266,6 @@ class wide_string_input_adapter : public input_adapter_protocol std::size_t utf8_bytes_index = 0; /// number of valid bytes in the utf8_codes array std::size_t utf8_bytes_filled = 0; - - /// the last character (returned after unget_character() is called) - std::char_traits::int_type last_char = 0; - /// whether get_character() should return last_char - bool next_unget = false; }; class input_adapter