Open chrisse74 opened 1 year ago
This patch fails on C++03, because you need to provide a body for the function in the case that the compiler doesn't support = default
.
So, for example, if you have:
template<typename T>
class device_close_operation {
public:
typedef void result_type;
device_close_operation(T& t, BOOST_IOS::openmode which)
: t_(t), which_(which)
{ }
void operator()() const { boost::iostreams::close(t_, which_); }
private:
BOOST_DELETED_FUNCTION(device_close_operation& operator=(const device_close_operation&))
T& t_;
BOOST_IOS::openmode which_;
};
you can't just add:
BOOST_DEFAULTED_FUNCTION(device_close_operation(const device_close_operation&), {});
because that leaves the reference member t_
uninitialized.
Instead, you need to say something like:
BOOST_DEFAULTED_FUNCTION(device_close_operation(const device_close_operation& rhs), : t_(rhs.t_) { which_ = rhs.which_; });
Thanks for the explanation @mclow - working on it.
I had to drop three BOOST_DEFAULTED_FUNCTION() declarations (but commented this) to avoid "Uninitialized reference member" errors. Unfortunately the initializer list can only take one parameter, when using BOOST_DEFAULTED_FUNCTION.
I have also been trying to fix couple of these warnings in #154 (but less than this pull request). Would it be possible to consider one of these pull request ?
Also, i know some boost libraries dropped C++03 support in recent releases, I don't know if this is the case of boost iostream too.
Fixes several deprecated-copy warnings by using the BOOST_DEFAULTED_FUNCTION() macro.