Reputation: 1334
I love the Move definition location refactoring feature of Visual Studio 2015 except one thing.
It automatically insert inline
keyword ahead of function definition.
So I always had to remove them by my self.
It is like this.
class GameLoop
{
public:
void drawGame() {
}
};
//GameLoop.h
class GameLoop
{
public:
void drawGame();
};
//GameLoop.cpp
inline void GameLoop::drawGame() {
}
Anybody knows how to disable this auto inline
keyword?
Thanks.
For whom doesn't know where is this feature.
Move cursor on the method you want refactor
[Edit]->[Refactor]->[Move Definition Location]
or
Upvotes: 16
Views: 1422
Reputation: 45
According to https://learn.microsoft.com/en-us/cpp/ide/refactoring/move-definition-location?view=msvc-140 it seeems as if its function is to move from source to header file, not vice versa.
However, the inline keyword for non-template functions in the source file - as you describe - is semantically correct, since the function definition within the class definition is implicitly inline, but it is not really a desirable behavior. I agree. I guess you could post this as an improvement issue to the VS devs.
On a sidenote, what I observed for template functions was (in VS2019):
This behavior has much more merit in my opinion.
Upvotes: 3