inline bool operator==(const Foo& a, const Foo& b) { .. }
Member functions are implicit built-in if defined inside their class. The same is true for them: if they can be placed in the headline without the hassle, you can really do it.
Since the function code is placed in the header and visible, the compiler can embed calls in them, that is, put the function code directly on the call site (not so much because you inserted it before it, but more because the compiler solves this way, though. Input inline only hints for the compiler regarding this). This can lead to better performance, because the compiler now sees where the arguments correspond to variables local to this function, and where the argument is not aliased to each other - and, last but not least, the assignment of function frames is no longer required.
source share