内联函数(inline function)
Unlike other function definitions, inlines should be defined in header files.
To expand the code of an inline function at the point of call, the compiler must have access to the function definition. The function prototype is insufficient.
An inline function may be defined more than once in a program as long as the definition appears only once in a given source file and the definition is exactly the same in each source file. By putting inline functions in headers, we ensure that the same definition is used whenever the function is called and that the compiler has the function definition available at the point of call.
浙公网安备 33010602011771号