inline specifier
From cppreference.com
[edit] Syntax
inline function_declaration | |||||||||
[edit] Description
The inline keyword is a hint given to the compiler to perform an optimization. The compiler has the freedom to ignore this request.
If the compiler inlines the function, it replaces every call of that function with the actual body (without generating a call). This avoids extra overhead created by the function call (placing data on stack and retrieving the result) but it may result in a larger executable as the code for the function has to be repeated multiple times. The result is similar to function-like macros
The function body must be visible in the current translation unit.
Class methods defined inside the class body are implicitly declared inline.
[edit] Example
inline int sum(int a, int b) { return (a + b); } int c = sum(1, 4); // if the compiler inlines the function the compiled code will be the same as writing int c = 1 + 4;