Skip to content

Commit

Permalink
Removed deprecated-copy warning.
Browse files Browse the repository at this point in the history
Add implementation to various BOOST_DEFAULTED_FUNCTION.

Fixed various BOOST_DEFAULTED_FUNCTION.

Fixed various BOOST_DEFAULTED_FUNCTION when more than one reference is used.
  • Loading branch information
chrisse74 committed Jan 26, 2023
1 parent 65fc893 commit 06b7305
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/boost/iostreams/detail/adapter/concept_adapter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class concept_adapter {
{ BOOST_STATIC_ASSERT(is_std_io<T>::value); }
explicit concept_adapter(const T& t) : t_(t)
{ BOOST_STATIC_ASSERT(!is_std_io<T>::value); }
BOOST_DEFAULTED_FUNCTION(concept_adapter(const concept_adapter& rhs), : t_(rhs.t_) { BOOST_STATIC_ASSERT(!is_std_io<T>::value); });

T& operator*() { return t_; }
T* operator->() { return &t_; }
Expand Down
8 changes: 8 additions & 0 deletions include/boost/iostreams/detail/functional.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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&))
Expand All @@ -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&))
Expand All @@ -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&))
Expand All @@ -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&))
Expand All @@ -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&))
Expand All @@ -131,6 +136,7 @@ template<typename T>
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&))
Expand All @@ -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&))
Expand All @@ -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_)
Expand Down

0 comments on commit 06b7305

Please sign in to comment.