C++ inline function
inline function
When the function call, the caller will pass control of the callee, will carry out the necessary resource allocation, namely overhead.
If this advance preparation time is longer than the execution time than the callee, the call function is obviously uneconomical.
To prevent this from happening, we can be defined as a function inline function. Thus, the compiler will be (selectively) the caller to the callee alternative code, thereby eliminating the process of function calls.
The following code from TensorRT/samples/common/logging.h
:
inline LogStreamConsumer LOG_VERBOSE(const Logger& logger)
{
return LogStreamConsumer(logger.getReportableSeverity(), Severity::kVERBOSE);
}
Shows will be defined as a function of inline
the way.