It sounds like what you want is a histogram class where each instance is a little different.
class Histogram {
unsigned m_count;
std::string m_label;
public:
Histogram(std::string label) : m_count(0), m_label(label) {}
std::string & label () { return m_label; }
std::string label () const { return m_label; }
unsigned & count () { return m_count; }
unsigned count () const { return m_count; }
};
It might be easier to manage these within a map rather than a vector (unless you can actually classify the input into a number), but each histogram will need a unique label.
std::map<std::string, std::unique_ptr<Histogram> > histograms;
while (more_input()) {
input = get_input();
std::string classification = classify_input(input);
if (histograms[classification] == 0)
histograms[classification]
= std::unique_ptr<Histogram>(new Histogram(classification));
histograms[classification]->count() += 1;
}
std::vector.Histogram myHistograms[1000]orstd::vector<Histrogram> myHistograms. But the actual implementation depends on yourHistogram, especially its constructor and assignment methods.