Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed deprecated-copy warning #156

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

chrisse74
Copy link
Contributor

Fixes several deprecated-copy warnings by using the BOOST_DEFAULTED_FUNCTION() macro.

@mclow
Copy link
Contributor

mclow commented Jan 22, 2023

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_; });

@chrisse74
Copy link
Contributor Author

Thanks for the explanation @mclow - working on it.

Add implementation to various BOOST_DEFAULTED_FUNCTION.

Fixed various BOOST_DEFAULTED_FUNCTION.

Fixed various BOOST_DEFAULTED_FUNCTION when more than one reference is used.
@chrisse74
Copy link
Contributor Author

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.

@Romain-Geissler-1A
Copy link
Contributor

Romain-Geissler-1A commented Aug 15, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants