I read about there is something called free functions in this article by Scott Meyers and this talk by Klaus Iglberger.
Here is the question: Is it good to use non-member versions (free functions) in an interview?
vector<int> v(10, -1);
int size = 0;
size = v.size(); // (a) member function
size = std::size(v); // (b) free function
queue<int> q;
q.push(123);
while (!q.empty()) {} // (a) member function
while (!empty(q)) {} // (b) free functionI am having a hard time deciding which one I would stick to in an interview... Member functions make the code look consistent by always using syntax like obj.func(). However, it seems that using free functions could also be a better practice in real world. Could anyone provide some suggestions based on your interview experience?