内联函数不是在调用时发生控制转移,而是在编译时将函数体嵌入在每一个调用处。

这样就节省了参数传递、控制转移等开销。

 

View Code
#include "iostream"
#include "string"
using namespace std;

inline void print(string Str)
{
    cout<<Str<<endl;
}
int main()
{
    string Str;
    while(cin>>Str) print(Str);
}

相关文章:

  • 2021-11-16
  • 2022-12-23
  • 2022-12-23
  • 2022-03-07
  • 2022-12-23
  • 2021-06-15
猜你喜欢
  • 2022-12-23
  • 2022-01-07
  • 2021-09-19
  • 2022-01-29
  • 2022-12-23
相关资源
相似解决方案