问题
#include <iostream>
using namespace std;
void f();
int main(){
f();
}
void f(){
cout << "Hello Stackoverflow!" << endl;
}
If I wanted to succeed in making this function inline, would I need to specify inline in the declaration or definition, or both? I know that inline functions are normally defined in headers so normally there shouldn't be a separate declaration, but I was curious about the few unique cases where there are.
来源:https://stackoverflow.com/questions/32020122/inline-specification-on-ordinary-functions-is-it-needed-on-the-declaration-def