From 41b0704ce1266af31bf15584d672b065b1581612 Mon Sep 17 00:00:00 2001 From: Francois Chabot Date: Mon, 2 Mar 2020 23:50:01 -0500 Subject: [PATCH] removed move assignments from input adapters --- .../nlohmann/detail/input/input_adapters.hpp | 19 +++---------------- single_include/nlohmann/json.hpp | 19 +++---------------- 2 files changed, 6 insertions(+), 32 deletions(-) diff --git a/include/nlohmann/detail/input/input_adapters.hpp b/include/nlohmann/detail/input/input_adapters.hpp index 142aba28..7ad26d00 100644 --- a/include/nlohmann/detail/input/input_adapters.hpp +++ b/include/nlohmann/detail/input/input_adapters.hpp @@ -43,7 +43,7 @@ class file_input_adapter file_input_adapter(const file_input_adapter&) = delete; file_input_adapter(file_input_adapter&&) = default; file_input_adapter& operator=(const file_input_adapter&) = delete; - file_input_adapter& operator=(file_input_adapter&&) = default; + file_input_adapter& operator=(file_input_adapter&&) = delete; std::char_traits::int_type get_character() noexcept { @@ -85,6 +85,7 @@ class input_stream_adapter // delete because of pointer members input_stream_adapter(const input_stream_adapter&) = delete; input_stream_adapter& operator=(input_stream_adapter&) = delete; + input_stream_adapter& operator=(input_stream_adapter&& rhs) = delete; input_stream_adapter(input_stream_adapter&& rhs) : is(rhs.is), sb(rhs.sb) { @@ -92,20 +93,6 @@ class input_stream_adapter rhs.sb = nullptr; } - input_stream_adapter& operator=(input_stream_adapter&& rhs) - { - if (is) - { - is->clear(is->rdstate() & std::ios::eofbit); - } - - is = rhs.is; - sb = rhs.sb; - rhs.is = nullptr; - rhs.sb = nullptr; - return *this; - } - // std::istream/std::streambuf use std::char_traits::to_int_type, to // ensure that std::char_traits::eof() and the character 0xFF do not // end up as the same value, eg. 0xFFFFFFFF. @@ -138,7 +125,7 @@ class input_buffer_adapter input_buffer_adapter(const input_buffer_adapter&) = delete; input_buffer_adapter& operator=(input_buffer_adapter&) = delete; input_buffer_adapter(input_buffer_adapter&&) = default; - input_buffer_adapter& operator=(input_buffer_adapter&&) = default; + input_buffer_adapter& operator=(input_buffer_adapter&&) = delete; std::char_traits::int_type get_character() noexcept { diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index a587f954..83116355 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -3906,7 +3906,7 @@ class file_input_adapter file_input_adapter(const file_input_adapter&) = delete; file_input_adapter(file_input_adapter&&) = default; file_input_adapter& operator=(const file_input_adapter&) = delete; - file_input_adapter& operator=(file_input_adapter&&) = default; + file_input_adapter& operator=(file_input_adapter&&) = delete; std::char_traits::int_type get_character() noexcept { @@ -3948,6 +3948,7 @@ class input_stream_adapter // delete because of pointer members input_stream_adapter(const input_stream_adapter&) = delete; input_stream_adapter& operator=(input_stream_adapter&) = delete; + input_stream_adapter& operator=(input_stream_adapter&& rhs) = delete; input_stream_adapter(input_stream_adapter&& rhs) : is(rhs.is), sb(rhs.sb) { @@ -3955,20 +3956,6 @@ class input_stream_adapter rhs.sb = nullptr; } - input_stream_adapter& operator=(input_stream_adapter&& rhs) - { - if (is) - { - is->clear(is->rdstate() & std::ios::eofbit); - } - - is = rhs.is; - sb = rhs.sb; - rhs.is = nullptr; - rhs.sb = nullptr; - return *this; - } - // std::istream/std::streambuf use std::char_traits::to_int_type, to // ensure that std::char_traits::eof() and the character 0xFF do not // end up as the same value, eg. 0xFFFFFFFF. @@ -4001,7 +3988,7 @@ class input_buffer_adapter input_buffer_adapter(const input_buffer_adapter&) = delete; input_buffer_adapter& operator=(input_buffer_adapter&) = delete; input_buffer_adapter(input_buffer_adapter&&) = default; - input_buffer_adapter& operator=(input_buffer_adapter&&) = default; + input_buffer_adapter& operator=(input_buffer_adapter&&) = delete; std::char_traits::int_type get_character() noexcept {