C ++ December notes

Source: Internet
Author: User
1. STD: String read on write mechanism, STD: string in the standard library. During the replication, the internal buffered string is not copied immediately, it is copied only when the string is edited. This is not described on C ++ primer. This reminds me of the C # string. All edits that cannot be modified on the string return a new string, similar to a string in Python, but Python caches small objects, small strings are directly cached to improve efficiency. The strings in Delphi are very similar to C ++'s STD: String. The first few strings are used to record the reference numbers of this string, when the string is edited, a copy is copied and a reference of the string is reduced. It seems that strings are processed a lot in each language and cannot be small. 2. Notes for using C ++ static variables. For this static object, the book describes how to store the common content of each object in the class, or record some content such as the number of generated objects, do not use other static variables during static variable initialization. I made a huge mistake here. reference the old saying: "Although static variables can be initialized before other variables, but the initialization sequence of static variables cannot be guaranteed. Note.

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.