Where to put local auxiliary functions?
Hi everyone,
I've taken a C++ class this semester and now I'm writing the seminal program, which is my first large-ish C++ project.
Usually it's a good idea to split code into smaller auxiliary functions when something grows too large. The question I want to ask is where is a good place to put those.
Say I have a .cpp and .hpp files with some class, and I'd like to make a function to perform some task that will not be needed anywhere else but some method or whatever. The obvious thing to do would be simply to define the function in the .cpp file and use it as needed. However, I've been told that this is not a good idea because the function will be global and may clash with other functions like this etc.
So what do I do with them, how do I make them more local? Are namespaces the answer? If so, do I make a namespace just for the aux. functions? Or should I wrap each class in its own namespace and put the aux. functions inside it? Or make a namespace for the whole program?
Thanks for any tips.