1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
// list::max_size
#include <iostream>
#include <list>
int main ()
{
unsigned int i;
std::list<int> mylist;
std::cout << "Enter number of elements: ";
std::cin >> i;
if (i<mylist.max_size()) mylist.resize(i);
else std::cout << "That size exceeds the limit.\n";
return 0;
}
| |