Demonstrate allocator's max_size() fucntion in vector
#include <iostream> #include <vector> using namespace std; int main() { vector<short int>::allocator_type vectorShortIntAllocator; vector<int>::allocator_type vectorIntAllocator; vector<long int>::allocator_type vectorLongAllocator; vector<float>::allocator_type vectorFloatAllocator; vector<double>::allocator_type vectorDoubleAllocator; cout << "Here are the number of object that can be allocated.\n"; cout << "short integers: "; cout << vectorShortIntAllocator.max_size() << endl; cout << "integers: "; cout << vectorIntAllocator.max_size() << endl; cout << "long integers: "; cout << vectorLongAllocator.max_size() << endl; cout << "floats: "; cout << vectorFloatAllocator.max_size() << endl; cout << "doubles: "; cout << vectorDoubleAllocator.max_size() << endl; return 0; }