Hi there. I'm currently building a set of common functions (Search algorithm implementations), and think I'm doing the grouping wrong. At the moment, I have a class, Sorting, that is declared in a file called Sorting.h (it's nowhere near finished yet, btw) like so:
#ifndef SORTING_H
#define SORTING_H
#include <vector>
class Sorting {
private:
Sorting();
Sorting(const Sorting& orig);
virtual ~Sorting();
public:
static void bubbleSort(std::vector<int>& A);
// etc
};
#endif /* SORTING_H */
Now, because the constructor is private, a user cannot instantiate my class - it effectively is just a holder for static functions that the user can call. However, from what I have read of C++ so far - and from looking at the STL libraries etc- I think I'm doing this wrong. Should I instead have a namespace called 'Sorting' or something of the sort? If so, what does my header file (the one the user would include) look like? And would I have to change the structure of the rest of the files? At the moment each set of algorithms is in it's own cpp file (i.e. BubbleSort.cpp, CocktailSort.cpp, etc).
Apologies for what may be a duplicate question - I did search for C++ and namespace, but I got very general questions about namespaces back and none seemed to be this specific problem.