kryton9
23-12-2011, 07:40
I wrote this little test program to find the size limits of some of the Standard Template Library Containers. I would like to see what differences, if any, and which situations machine to machine, OS to OS or both.
It is a console app. You might need to scroll up to see the whole output. It will give your results first and then print my results for reference.
The code listing is just for reference. The attachment has the executable console app.
#include <iostream>
#include <stdlib.h>
#include <vector>
#include <list>
#include <map>
using namespace std;
int kvs = 1073741823;
int kvi = 1073741823;
int kls = 357913941;
int kli = 357913941;
int km = 178956970;
int main()
{
vector<string> vs;
vector<int> vi;
list<string> ls;
list<int> li;
map<int,string> m;
cout << endl << " Container Limits" << endl << endl ;
cout << " Your Results: "<< endl << endl;
cout << " Vector of strings: "<< vs.max_size() << endl;
cout << " Vector of integers: "<< vi.max_size() << endl << endl;
cout << " List of strings: "<< ls.max_size() << endl;
cout << " List of integers: "<< li.max_size() << endl << endl;
cout << "Map of ints and strings: "<< m.max_size() << endl << endl;
cout << "==================================================" << endl;
cout << " Kent's Results: "<< endl << endl;
cout << " Vector of strings: "<< kvs << endl;
cout << " Vector of integers: "<< kvi << endl << endl;
cout << " List of strings: "<< kls << endl;
cout << " List of integers: "<< kli << endl << endl;
cout << "Map of ints and strings: "<< km << endl << endl;
system("pause");
return 0;
}
It is a console app. You might need to scroll up to see the whole output. It will give your results first and then print my results for reference.
The code listing is just for reference. The attachment has the executable console app.
#include <iostream>
#include <stdlib.h>
#include <vector>
#include <list>
#include <map>
using namespace std;
int kvs = 1073741823;
int kvi = 1073741823;
int kls = 357913941;
int kli = 357913941;
int km = 178956970;
int main()
{
vector<string> vs;
vector<int> vi;
list<string> ls;
list<int> li;
map<int,string> m;
cout << endl << " Container Limits" << endl << endl ;
cout << " Your Results: "<< endl << endl;
cout << " Vector of strings: "<< vs.max_size() << endl;
cout << " Vector of integers: "<< vi.max_size() << endl << endl;
cout << " List of strings: "<< ls.max_size() << endl;
cout << " List of integers: "<< li.max_size() << endl << endl;
cout << "Map of ints and strings: "<< m.max_size() << endl << endl;
cout << "==================================================" << endl;
cout << " Kent's Results: "<< endl << endl;
cout << " Vector of strings: "<< kvs << endl;
cout << " Vector of integers: "<< kvi << endl << endl;
cout << " List of strings: "<< kls << endl;
cout << " List of integers: "<< kli << endl << endl;
cout << "Map of ints and strings: "<< km << endl << endl;
system("pause");
return 0;
}