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

C++

C++ Problem Overview


While reading the documentation for boost::test, I came across the term "free function". What I understand is that a free function is any function that doesn't return anything (Its return type is void). But after reading further it seems that free functions also don't take any arguments. But I am not sure. These all are my assumptions. So could anybody define free function?

C++ Solutions


Solution 1 - 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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJameView Question on Stackoverflow
Solution 1 - C++Georg FritzscheView Answer on Stackoverflow