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

C++ extract function fails with overload on const #11

Open
JayBazuzi opened this issue Sep 23, 2018 · 2 comments
Open

C++ extract function fails with overload on const #11

JayBazuzi opened this issue Sep 23, 2018 · 2 comments
Labels
C++ This is in a C++ recipe Extract Function The extract function recipe

Comments

@JayBazuzi
Copy link
Contributor

struct C
{
	int Get() { return 1; }
	int Get() const { return 2; }
};

int F()
{
	C c;
	// extract method begin
	return c.Get();
	// extract method end
}
@JayBazuzi
Copy link
Contributor Author

5.3 says "Paste into the parameter list and inject const auto in front of each parameter".

One fix would be to remove the const from that, and then add another step to add const to any parameters.

@arlobelshee
Copy link
Contributor

Eve if we split that step, how would compiler detect this as a failure and not just have the second step switch which one you call?

@arlobelshee arlobelshee added C++ This is in a C++ recipe Extract Function The extract function recipe labels Oct 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C++ This is in a C++ recipe Extract Function The extract function recipe
Projects
None yet
Development

No branches or pull requests

2 participants