| Operation | Effect |
|---|
| c.size() | Returns the actual number of elements |
| c.empty() | Returns if the container is empty |
| c.max_size() | Returns the maximum number of elements possible |
| c1==c2 | Returns if c1 is equal to c2 |
| c1!=c2 | Returns if c1 is not equal to c2 (equivalent to !(c1==c2)) |
| c1<c2 | Returns if c1 is less than c2 |
| c1>c2 | Returns if c1 is greater than c2 (equivalent to c2<c1) |
| c1<=c2 | Returns if c1 is less than or equal to c2 (equivalent to !(c2<c1)) |
| c1>=c2 | Returns if c1 is greater than or equal to c2 (equivalent to !(c1<c2)) |
| Operation | Effect |
|---|
| c.insert(prev_pos,el) | Inserts before iterator position prev_pos a copy of el and returns the position of the new element |
| c.insert(prev_pos,nr,el) | Inserts before iterator position prev_pos nr copies of el (returns nothing) |
| c.insert(prev_pos,beg,end) | Inserts before iterator position prev_pos a copy of all elements of the range [beg,end) (returns nothing) |
| c.push_back(el) | Appens a copy of el at the end |
| c.pop_back() | Removes the last element (does not return it) |
| c.push_front(el) | Inserts a copy of el at the beginning |
| c.pop_front() | Removes the first element (does not return it) |
| c.remove(v) | Removes all elements with value v |
| c.remove_if(op) | Removes all elements for which op(elem) yields true |
| c.erase(prev_pos) | Removes the element at iterator position prev_pos |
| c.erase(beg,end) | Removes all elements of the range [beg,end) |
| c.erase_after(prev_pos) | Removes the element after the element pointed by prev_pos of the slist and returns the first element remaining beyond the removed elements, or end() if no such element exists |
| c.erase_after(before_first,last) | Removes the range (before_first, last) from the slist and returns the first element remaining beyond the removed elements, or end() if no such element exists |
| c.resize(nr) | Inserts or removes elements at the end such that the size becomes nr (new elements are default constructed) |
| c.resize(nr,el) | Inserts or removes elements at the end such that the size becomes nr. New elements are copy constructed from el |
| c.clear() | Removes all elements (makes the slist empty) |
| Operation | Effect |
|---|
| c.unique() | Removes duplicates of consecutive elements with the same value |
| c.unique(op) | Removes duplicates of consecutive elements, for which op() yields true |
| c1.splice(pos,c2) | Moves all elements of c2 to c1 in front of the iterator position pos |
| c1.splice(pos,c2,c2pos) | Moves the element at c2pos in c2 in front of pos of slist c1 (c1 and c2 may be the same) |
| c1.splice(pos,c2,c2beg,c2end) | Moves all elements of the range [c2beg,c2end) in c2 in front of pos of slist c1 (c1 and c2 may be the same) |
| c1.splice_after(pos,c2) | Transfers all the elements of slist c2 to c1, after the element pointed by pos |
| c.sort() | Sorts all elements with operator < |
| c1.merge(c2) | Assuming both slist contain the elements sorted, moves all elements of c2 into c1 so that all elements are merged and still sorted |
| c1.merge(c2,op) | Assuming both slist contain the elements sorted due to the sorting criterion op(), moves all elements of c2 into c1 so that all elements are merged and still sorted according to op() |
| c.reverse() | Reverses the order of all elements |