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

Warning to create namespace swap fails with template classes #39

Closed
rmerriam opened this issue Jun 24, 2017 · 4 comments
Closed

Warning to create namespace swap fails with template classes #39

rmerriam opened this issue Jun 24, 2017 · 4 comments

Comments

@rmerriam
Copy link

Trying to create a simple example for another issue I ran into the suggestion to create swap functions for a template class. After creating the namespace swap function it is not recognized and the warning continues.

#include <vector>
#include <utility>

template <typename T>
struct A {
    std::vector<T> mValues { };

    void swap(A& other) noexcept {
        using std::swap;
    }
};

template <typename T>
void swap(A<T>& a, A<T>& b) noexcept {
    a.swap(b);
}

I let the "quick fix" create both swaps. The namespace swap was generated as a regular function. I changed it to being a template.

@tcorbat
Copy link

tcorbat commented Jun 24, 2017 via email

@rmerriam
Copy link
Author

I've 9,000 lines of code from a recent project that I'm running through the process.

There are a number of the refactoring capabilities I don't understand. Is there more detailed documentation somewhere? I don't see it on the web site, at least.

@tonisuter
Copy link

Unfortunately, the user guides of the various refactoring plug-ins are spread across various websites:

I hope this helps.

@tcorbat
Copy link

tcorbat commented Aug 11, 2017

We've fixed the creation of the namespace level swap function for templates. The quick fix should now make swap a template too and and the required template parameters.

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

No branches or pull requests

4 participants