C++0x__c++

Source: Internet
Author: User
Tags garbage collection









c++0x Editor
C + + is a programming language with international standards, commonly called ANSI/ISO c++,1998 International Standard Organization (ISO) promulgated the C + + language International standard ISO/IEC 1488-1998. 1998 is the first year of the C + + Standards Committee, the next every 5 years as the actual need to update the standard, the most recent standard update is in 2009, currently we generally call the standard c++0x. Unfortunately, because of the complexity of the C + + language and his years of evolution, it was only in 2009 that the compiler for the CTP development environment in Visual C + + was fully compliant with this standard. The main focus of the C + + committee is that in the development of the language core, c++0x's areas of core language will be greatly improved, including multi-threaded support, generic programming, unified initialization, and performance enhancement. Directory

1 International standards

2 Core languages

3 Performance enhancement ▪ Right value reference and transfer semantics ▪ generalization of a constant expression ▪ the modification of the pod definition

4 Performance enhancement

5 usability ▪ initializing list ▪ Unified initialization ▪ type presumption ▪ new function syntax ▪ constraints ▪ object building improvements ▪ null pointers ▪ strongly typed enumerations ▪ angle brackets ▪ explicit conversion operators ▪ template aliases ▪ Unlimited unions

6 language capabilities ▪ variable length parameter templates ▪ new string constants ▪ user-defined literals ▪ multitasking memory model ▪ thread-local storage ▪ about default member functions ▪long long int type ▪ static assertion ▪sizeof operator change ▪ transparent garbage Garbage collection

7 compilation Support1 International Standard EditionC++0x (also known as C++11) The final international vote ended on August 10, 2011, and all countries voted in favour. ISO published on September 1, 2011 ISO/IEC 14,882:2011, the name isInformation Technology--programming languages--C + +Edition:3 C + + 2011 officially becomes the new C + + standard C + + 2011 replaces the existing C + + standard ISO/IEC 14882, which was published in 1998 and updated in 2003, generally known as c++98 and c++03. The new standard PDF document can be purchased on its ISO official website.2 Core Language editorsThe main focus of the C + + committee is on the development of the language core. Therefore, the date of publication of c++0x depends on this part of the standard operating schedule. The domain of the core language will be greatly improved, including multi-threaded support, generic programming, unified initialization, and performance enhancement. This is divided into 4 blocks to discuss the characteristics of the core language and change: the performance of the operation period of strengthening, the construction period of performance enhancement, usability enhancement, and a new function. Some features may belong to multiple blocks at the same time, but this feature is described only in its most representative block. March 27, 2011, the IS0 C + + Committee formally approved the final draft of the C + + programming language International standard (FDIS). The standard itself has been completed, followed by a revised draft of the work on the revision of the Committee's meetings, which is expected to be completed in three weeks and then handed over to Ittf, Geneva, where the latest C + + standard will be released in the summer, and the new standard previously named c++0x as C + + 2011. From the 2003 c++03 to the 2011 C + + 2011, the new standard was set up after 8 years. Both GCC and the Visual C + + compilers have joined the c++2011/c++0x support.3 Performance Enhancement Editor right value reference and transfer semantics In the old standard C + + language, the temporary amount (the term right, as it appears on the right side of the assignment expression) can be passed to the function, but can only be accepted as a const & type. This allows the function to distinguish between a true right value or a normal const variable passed to the const &. Also, because the type is const, the function cannot change the value of the object being passed. C++0X will add a new reference type called the right value reference, which is written as TypeName &&. This type can be accepted as a non-const value, allowing changes to its value. This change will allow some objects to create transfer semantics. For example, a std::vector, in terms of its internal implementation, is a C-type array encapsulation. If you need to create a vector temp or return a vector from a function, you can only store the data by creating a new vector and copying all the data stored in the right value. The temporary vector is then destroyed and the data contained in it is deleted. With a right value reference, a std::vector transfer constructor that refers to the right value of a vector can simply copy the pointer of the C-type array in the right value to the new vector and then empty the right value. There is no array copy, and destroying the empty right value does not destroy the memory that holds the data. Functions that return vectors now only need to return a std::vector<>&&. If the vector does not transfer the constructor, the result will be the same as before: Call its copy constructor with the std::vector<> & parameter. If the vector does have a transfer constructor, then the transfer constructor is invoked to avoid a large amount of memory allocation. Given the security factor, a named variable will not be treated as a right value even if it is declared to be a right value type. Use the library function Std::move () If you want it to be the right value. BOOL Is_r_value (int &&) {return true;} bool Is_r_value (const int &) {return false;} void Test (int &&am P;i) {is_r_value (i);//False Is_r_value (Std::move (i));//true} for the intrinsic characteristics of the right value reference definition and some modifications to the definition of the left value reference (general reference), now the right value reference allows the

Related Article

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.