Skip to content

Remove redundant copy constructor.#160

Open
ecatmur wants to merge 1 commit into
boostorg:developfrom
ecatmur:deprecated-copy
Open

Remove redundant copy constructor.#160
ecatmur wants to merge 1 commit into
boostorg:developfrom
ecatmur:deprecated-copy

Conversation

@ecatmur

@ecatmur ecatmur commented Feb 22, 2023

Copy link
Copy Markdown

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

mclow commented Feb 22, 2023

Copy link
Copy Markdown
Contributor

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

@ecatmur

ecatmur commented Feb 22, 2023

Copy link
Copy Markdown
Author

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