Standard container Section

Source: Internet
Author: User

1 Element

The element of the container is a copy of the inserted object. Therefore, the element must belong to a type that allows the container implementation to replicate the object. Containers can use the copy constructor or assign values to copy elements.

2 Comparison

The associated container requires that its elements be ordered. The default method is <operator definition. If not, you can provide more appropriate comparison operations. For example, define a function object.

For the sequence criterion CMP:

1 CMP (x, x) = false.

2 If CMP (x, y) and CMP (Y, Z), then CMP (Y, Z ).

3 define equiv (X, Y) is! (CMP (x, y) | CMP (Y, x )).

4. Other Relational operators can be constructed through <and =.

Binary Sequence

1 List

Bonding splice (). This is equivalent to cutting the paste and not copying it.

Merge () Merge and sort. In this case, make sure that the order of the two lists is the same as that of the target list. The default order for the first member function is ascending order.

Map set mulltimap Multiset

Map

By default, the key code is less than <. However, you can use the last parameter or the constructor parameter to provide an alternative operation.

For subscript []. Because [] always requires V (), if the value type of a map does not have a default value, it cannot be used for subscript operations. This is an unfortunate constraint for standard associated containers ..

For multimap, The subscripts [] are not supported, and the values of _ range (), lower_bound (), and uper_bound () are used.

Binary container string valarray bitset

 

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.