What is the meaning of the term “free function” in C++?

The term free function in C++ simply refers to non-member functions. Every function that is not a member function is a free function.

struct X {
    void f() {}               // not a free function
};
void g() {}                   // free function
int h(int, int) { return 1; } // also a free function

Leave a Comment