正在加载图片...
Sequential Containers(cont) u Important member functions Constructor and initialization push back(, pop backo, back(all 3 containers push_ fronto, pop_ fronto, fronto (only list deque) inserto and erase list<string> slist //generate empty container list<string> slist(1024) //generate container with specified size and with default value list<string> slist(1024,"Hi); generate container with specified size and specified value inta[6]={1,2,3,4,5,6} list<int> ilist(a, a+6) /using 2 iterators to specify a range of elements as initial value list<string> slist1(1024,"Hi) list<string> slist2(slist 1); / generate a new container, copy the elements of an old one as initial valuesSequential Containers (cont.) ◼ Important member functions ◼ Constructor and initialization ◼ push_back(), pop_back(), back() (all 3 containers) ◼ push_front(), pop_front(), front() (only list & deque) ◼ insert() and erase() list<string> slist; //generate empty container list<string> slist(1024); //generate container with specified size and with default value list<string> slist(1024, “Hi”); //generate container with specified size and specified value int a[6] = {1, 2, 3, 4, 5, 6}; list<int> ilist(a, a+6); //using 2 iterators to specify a range of elements as initial value list<string> slist1(1024, “Hi”); list<string> slist2(slist1); //generate a new container, copy the elements of an old one as initial values
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有