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

Remove redundant copy constructor. #160

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

ecatmur
Copy link

@ecatmur ecatmur commented Feb 22, 2023

Since C++11, a user-declared copy constructor deprecates the copy assignment operator.

This change allows clean compilation with the -Wdeprecated-copy/-Wdeprecated-copy-with-user-provided-ctor flag.

Since C++11, a user-declared copy constructor deprecates the copy assignment operator.

This change allows clean compilation with the -Wdeprecated-copy/-Wdeprecated-copy-with-user-provided-ctor flag.
@mclow
Copy link
Contributor

mclow commented Feb 22, 2023

is this redundant? In C++03?
An alternative approach would be to define the copy-assignment operator.

@ecatmur
Copy link
Author

ecatmur commented Feb 22, 2023

Yes, this is Note 113 in C++03:

  1. Because a template constructor is never a copy constructor, the presence of such a template does not suppress the implicit declaration of a copy
    constructor. Template constructors participate in overload resolution with other constructors, including copy constructors, and a template constructor
    may be used to copy an object if it provides a better match than other constructors.

I can add the copy assignment operator if you'd prefer.

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.

2 participants