Refactoring, moving function definition outside of a class body and inline it automatically.
Answered
I want this:
struct Potato
{
void peel(){}
};
Refactor to this:
struct Potato
{
void peel();
};
inline void Potato::peel()
{
}
Does anyone have a an idea how to do this?
Please sign in to leave a comment.
Hello!
You can use a "Split function into declaration and definition" intention action. Place the cursor near a function name, press
Alt+Enter( a default "Show intention actions and quick-fixes" shortcut) and choose "Split function into declaration and definition":As for the "inline" option - feel free to create a feature request in our tracker: https://youtrack.jetbrains.com/issues/CPP.
Than you for reply,
I am aware of split action, but once function is split there is no way back. Once definition is in cpp file and declaration is in h file, there is no way to move it back to the body of the class located in h file. Am I mistaken?
Piotr, for moving definition back feel free to comment or upvote https://youtrack.jetbrains.com/issue/CPP-13179.