STL's associated container

Source: Internet
Author: User

The associative container contains map, set, Multimap, Multiset.

The characteristic of the associative container is obvious, relative to the sequential container, has the following characteristics:

1, its internal is the use of non-linear two-fork tree structure, in particular, the red and black tree structure to achieve the principle.

2, set and map ensure the uniqueness of elements, multiset and Multimap extend this attribute, you can allow the element is not unique.

3, the element can be an ordered collection, by default when inserted in ascending order.

The basic usage of the associative container is the same:

Begin () returns the iterator to the first element pointed to

Clear () Clears all elements

COUNT () returns the number of elements of a value

Empty () How the collection is null and returns True

End () The iterator that returns the last element

Erase (key) deletes all elements that are equal to the key value

Erase (IT) removes the element that the IT iterator points to

Erase (Start,end) removes the element from the iterator start to end

Find () returns the first iterator that points to the found element

Insert (It,val) inserts Val before iterator it

Lower_bound (Val) returns an iterator that points to the first element greater than (or equal to) the Val value

Upper_bount (Val) returns an iterator that points to the first element greater than Val

The number of elements in the size () collection

STL's associated container

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.