Tag Archives: inline

The inline keyword in C++

You shouldn’t use inline as a hint to the compiler that your code should be inlined – the compiler knows much better than you what to inline. My rules for using inline are:

You must use inline if you are defining an explicit specialization or instantiation of a template in a header
You should use inline if you are defining a function in a header that will be compiled into multiple compilation units