Reputation: 6636
Normally when we define a member function directly in the class body, it is implicitly inline
. But what about this:
class Foo {
public:
friend void swap(Foo& a, Foo& b) { ... }
...
};
Is the swap
implicitly inline
or not?
Upvotes: 1
Views: 860
Reputation: 72431
Yes. See [class.friend/6-7] from the Standard:
A function can be defined in a friend declaration of a class if and only if the class is a non-local class (9.8), the function name is unqualified, and the function has namespace scope.
Such a function is implicitly
inline
.
Upvotes: 5