Inline function is an important feature in C++, which is commonly used with classes. These are the short functions, where the codes are expanded in line at the point of each invocation. This process is similar to using a function-like macro. To cause a function to be expanded in line rather than called, precede its definition with the inline keyword.
For example, in this program, the function max() is expanded in line instead of called:
As far as the compiler is concerned, the preceding program is equivalent to this one:
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.