Relationships between five iterators for C + +

Source: Internet
Author: User

Iterator Operation Instructions
(1) All iterators
p++ Post-built self-increment iterator
++p forward self-increment iterator
(2) Input iterator
*p Complex reference iterator, as Rvalue
P=p1 assigning an iterator to another iterator
P==P1 comparison of equality of iterators
P!=p1 comparison of the inequality of iterators
(3) Output iterator
*p Complex reference iterator, as Lvalue
P=p1 assigning an iterator to another iterator
(4) Forward iterator
Provides all the functions of an input-output iterator
(5) Bidirectional iterator
--p pre-built-in self-reducing iterators
p--post-offset self-reducing iterator
(6) Random iterators
P+=i increments the iterator I bit
P-=i decrements the iterator i-bit
P+i iterator after P-bit plus I-bit
P-i iterator after P-bit minus I bit
P[i] Returns the element reference of the P-bit element deviating from the I bit
P<P1 returns True if the position of the iterator P is before P1, otherwise false
Returns true if the position of the P<=P1 P is in front of the P1 or in the same position, otherwise false
P>P1 returns True if the position of the iterator P is P1, otherwise false
P>=P1 P's position returns true at the back of the P1 or in the same position, otherwise false

Only sequential containers and associative containers support iterator traversal, and the categories of iterators supported by each container are as follows:
Iterator categories supported by container-supported iterator category containers for containers
Vector random Access deque random access list bidirectional
Set bidirectional multiset bidirectional map double To
Multimap bidirectional stack does not support queue not supported
Priority_queue not supported

Relationships between five iterators for C + +

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.