From 06b7305c41ffbfa976204aed2ea3739937ee2865 Mon Sep 17 00:00:00 2001 From: Christian Maurer Date: Tue, 17 Jan 2023 12:36:34 +0100 Subject: [PATCH] Removed deprecated-copy warning. Add implementation to various BOOST_DEFAULTED_FUNCTION. Fixed various BOOST_DEFAULTED_FUNCTION. Fixed various BOOST_DEFAULTED_FUNCTION when more than one reference is used. --- .../boost/iostreams/detail/adapter/concept_adapter.hpp | 1 + include/boost/iostreams/detail/functional.hpp | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/include/boost/iostreams/detail/adapter/concept_adapter.hpp b/include/boost/iostreams/detail/adapter/concept_adapter.hpp index 69a911565..4c3768612 100644 --- a/include/boost/iostreams/detail/adapter/concept_adapter.hpp +++ b/include/boost/iostreams/detail/adapter/concept_adapter.hpp @@ -66,6 +66,7 @@ class concept_adapter { { BOOST_STATIC_ASSERT(is_std_io::value); } explicit concept_adapter(const T& t) : t_(t) { BOOST_STATIC_ASSERT(!is_std_io::value); } + BOOST_DEFAULTED_FUNCTION(concept_adapter(const concept_adapter& rhs), : t_(rhs.t_) { BOOST_STATIC_ASSERT(!is_std_io::value); }); T& operator*() { return t_; } T* operator->() { return &t_; } diff --git a/include/boost/iostreams/detail/functional.hpp b/include/boost/iostreams/detail/functional.hpp index 61c7a371c..c4f594733 100644 --- a/include/boost/iostreams/detail/functional.hpp +++ b/include/boost/iostreams/detail/functional.hpp @@ -36,6 +36,7 @@ class device_close_operation { device_close_operation(T& t, BOOST_IOS::openmode which) : t_(t), which_(which) { } + BOOST_DEFAULTED_FUNCTION(device_close_operation(const device_close_operation& rhs), : t_(rhs.t_) { which_ = rhs.which_; }); void operator()() const { boost::iostreams::close(t_, which_); } private: BOOST_DELETED_FUNCTION(device_close_operation& operator=(const device_close_operation&)) @@ -50,6 +51,7 @@ class filter_close_operation { filter_close_operation(T& t, Sink& snk, BOOST_IOS::openmode which) : t_(t), snk_(snk), which_(which) { } + filter_close_operation(const filter_close_operation& rhs) : t_(rhs.t_), snk_(rhs.snk_), which_(rhs.which_) {}; // BOOST_DEFAULTED_FUNCTION can not handle more than one reference void operator()() const { boost::iostreams::close(t_, snk_, which_); } private: BOOST_DELETED_FUNCTION(filter_close_operation& operator=(const filter_close_operation&)) @@ -76,6 +78,7 @@ class device_close_all_operation { public: typedef void result_type; device_close_all_operation(T& t) : t_(t) { } + BOOST_DEFAULTED_FUNCTION(device_close_all_operation(const device_close_all_operation& rhs), : t_(rhs.t_) {}); void operator()() const { detail::close_all(t_); } private: BOOST_DELETED_FUNCTION(device_close_all_operation& operator=(const device_close_all_operation&)) @@ -87,6 +90,7 @@ class filter_close_all_operation { public: typedef void result_type; filter_close_all_operation(T& t, Sink& snk) : t_(t), snk_(snk) { } + filter_close_all_operation(const filter_close_all_operation& rhs) : t_(rhs.t_), snk_(rhs.snk_) {}; // BOOST_DEFAULTED_FUNCTION can not handle more than one reference void operator()() const { detail::close_all(t_, snk_); } private: BOOST_DELETED_FUNCTION(filter_close_all_operation& operator=(const filter_close_all_operation&)) @@ -113,6 +117,7 @@ class member_close_operation { member_close_operation(T& t, BOOST_IOS::openmode which) : t_(t), which_(which) { } + BOOST_DEFAULTED_FUNCTION(member_close_operation(const member_close_operation& rhs), : t_(rhs.t_) { which_ = rhs.which_; }); void operator()() const { t_.close(which_); } private: BOOST_DELETED_FUNCTION(member_close_operation& operator=(const member_close_operation&)) @@ -131,6 +136,7 @@ template class reset_operation { public: reset_operation(T& t) : t_(t) { } + BOOST_DEFAULTED_FUNCTION(reset_operation(const reset_operation& rhs), : t_(rhs.t_) {}); void operator()() const { t_.reset(); } private: BOOST_DELETED_FUNCTION(reset_operation& operator=(const reset_operation&)) @@ -147,6 +153,7 @@ class clear_flags_operation { public: typedef void result_type; clear_flags_operation(T& t) : t_(t) { } + BOOST_DEFAULTED_FUNCTION(clear_flags_operation(const clear_flags_operation& rhs), : t_(rhs.t_) {}); void operator()() const { t_ = 0; } private: BOOST_DELETED_FUNCTION(clear_flags_operation& operator=(const clear_flags_operation&)) @@ -167,6 +174,7 @@ class flush_buffer_operation { flush_buffer_operation(Buffer& buf, Device& dev, bool flush) : buf_(buf), dev_(dev), flush_(flush) { } + flush_buffer_operation(const flush_buffer_operation& rhs) : buf_(rhs.buf_), dev_(rhs.dev_), flush_(rhs.flush_) {}; // BOOST_DEFAULTED_FUNCTION can not handle more than one reference void operator()() const { if (flush_)