I'm wondering if I can define some functions in a header file and then use them in the same header file, while hiding them from anything else?
For example, can I first define some general helper functions(specific to the data-structures), and then define some data-structures in the same header that use those functions?
eg:
template<class T>
void Swap(T &a, T &b)
{
T temp = a;
a = b;
b = temp;
}
But I don't want Swap()
to interfere with other functions that have the same name.
I could make it a private method, but then I'd have to provide every class that uses it with the same implementation or make them friend class...