deque C ++ sequential containers

The constructor and destructor deque

deque <Elem> c; generating an empty deque

deque <Elem> c (c2); copy constructor

and <Middle> c = c2;

deque <Elem> c (n); n is the size

Dequan <Item> c (n, element); n 个 element

deque <Elem> c (begin, end); elemental within the interval [begin, end) of the initial value

deque <Elem> c (initlist); elemental initial value is the initial value column initlist

deque <Elem> c = initlist; ibid.

. C ~ deque (); destruction of all elements

non easier to operate deque

c.empty();  

c.size();

c.max_size();

c.shrink_to_size();

c1 = c2;

c1 != c2;

c2 > c2;

c1 < c2;

c1 >= c2;

c1 <= c2;

c[idx];

c.at(idx);

c.front();

c.back();

c.begin();

c.end();

c.cbegin ();

c.cend();

c.rbegin ();

c.rend ();

c.crbegin ();

c.crend();

No capacity and operational reserve

 

The type operation easier deque

c.assign (n, elem); Copies n to c elem

c.assign (beg, end); elements within the interval [begin, end) to copy c

c.assign (initlist); column copied to the initial value c

c1.swap(c2);      

swap (c1, c2); replacement of data c1 and c2, ibid.

c.push_back(elem);

c.pup_back();

c.push_front (element);

c.pop_front();

c.insert (pos, elem); elem before insertion iterator position pos, and returns the new position of the element

c.insert (pos, n, elem); Inserts n elem before the iterator position pos, and returns the first element of a new location

All elements insertion interval [begin, end) before the iterator position pos within; c.insert (pos, begin, end)

c.insert (pos, initlist); initial value column is inserted before the iterator position pos initlist

c.emplace (pos, args ...); inserting an initial value for the element in args before iterator position pos, and returns the new position of the element

c.emplace_back (args ...); args added at the end, no return

c.emplace_front (args ...); add args in the first column, no return

c.erase (pos); delete elements on the position pos

c.erase(beg,end);      

c.resize (num); num to the number of elements

c.resize (num, elem); the number of elements to num, extra number elem

c.clear();  

 

Guess you like

Origin www.cnblogs.com/chenguifeng/p/11790032.html