Honestly I would consider a rethink on your containers. The following uses a standard lib array, vector, and multimap to accomplish what I think you're looking for. The sample code just populates the table rows with the strings "A", "B", or "C" along with one of three IP addresses. The part you should pay special note to is the usage of the multimap to index your table based on IP address (though it could easily be retrofitted to do the same for any arbitrary column).
Note: there are plenty of people out there more proficient with the std lib algorithms, functions, and container usage than I. This is just to give you an idea of how a multimap may help in your possible solution.
EDIT OP wanted to see counts of the IP addresses in the table, the code for this has been amended to the tail of the main()
function. Also updated to not use C++11 features. Hopefully closer to something the OP can work with.
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
#include <map>
#include <vector>
#include <string>
using namespace std;
// some simple decls for our info, table, and IP mapping.
typedef std::vector<std::string> FlowInfo;
typedef std::vector<FlowInfo> FlowTable;
// a multi-map will likely work for what you want.
typedef std::multimap<std::string, const FlowInfo* > MapIPToTableIndex;
// a map of IP string-to-unsigned int for counting occurrences.
typedef std::map<std::string, unsigned int> MapStringToCount;
int main(int argc, char *argv[])
{
// populate your flow table using whatever method you choose.
// I'm just going to push 10 rows of three ip addresses each.
FlowTable ft;
for (size_t i=0;i<10;++i)
{
FlowInfo fi(47); // note: always fixed at 47.
for (size_t j=0;j<fi.size();++j)
fi[j] = "A";
fi[0][0]+=i;
fi[4] = "192.168.1.1";
ft.push_back(fi);
for (size_t j=0;j<fi.size();++j)
fi[j] = "B";
fi[0][0]+=i;
fi[4] = "192.168.1.2";
ft.push_back(fi);
for (size_t j=0;j<fi.size();++j)
fi[j] = "C";
fi[0][0]+=i;
fi[4] = "192.168.1.3";
ft.push_back(fi);
}
// map by IP address into something usefull.
MapIPToTableIndex infomap;
for (FlowTable::const_iterator it = ft.begin(); it != ft.end(); ++it)
infomap.insert(MapIPToTableIndex::value_type((*it)[4], &*it));
// prove the map is setup properly. ask for all items in the map
// that honor the 192.168.1.2 address.
for (MapIPToTableIndex::const_iterator it = infomap.lower_bound("192.168.1.2");
it != infomap.upper_bound("192.168.1.2"); ++it)
{
std::copy(it->second->begin(), it->second->end(),
ostream_iterator<std::string>(cout, " "));
cout << endl;
}
// mine the IP occurance rate from the table:
MapStringToCount ip_counts;
for (FlowTable::const_iterator it= ft.begin(); it!=ft.end(); ++it)
++ip_counts[ (*it)[4] ];
// dump IPs by occurrence counts.
for (MapStringToCount::const_iterator it = ip_counts.begin();
it != ip_counts.end(); ++it)
{
cout << it->first << " : " << it->second << endl;
}
return 0;
}
Output
B B B B 192.168.1.2 B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B
C B B B 192.168.1.2 B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B
D B B B 192.168.1.2 B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B
E B B B 192.168.1.2 B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B
F B B B 192.168.1.2 B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B
G B B B 192.168.1.2 B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B
H B B B 192.168.1.2 B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B
I B B B 192.168.1.2 B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B
J B B B 192.168.1.2 B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B
K B B B 192.168.1.2 B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B
192.168.1.1 : 10
192.168.1.2 : 10
192.168.1.3 : 10