Notes on the C ++ standard library generic algorithm reverse

Source: Internet
Author: User

In C ++ primer, the reverse elements of reverse are described as follows:

A container is, and after sort.

A container is, and later is.

Assume that a container is,. Why do you think reverse will be used? No error, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0.

But what about a container which is, 8? Is it 9, 8, 7, 6, 5, 4, 3, 2? Aren't they sorted in descending order?

This is what I used to understand. However, only in actual use can we know that reverse is sorted from time to time.AlgorithmOnly reverse sorting. 9, 8, 7, 6, 5, 4, 3, 2, 1, 0

After the reverse is changed to 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. To get the descending order method, it seems that you can first sort and then reverse. I don't know if I'm right.

VerificationCodeIt is very simple.

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.