C++11 Knowledge points

Source: Internet
Author: User

L Use {} for in-place initialization of all containers and data structures, and can be used directly for return values and for in-place initialization of custom types Initializer_list

L by rvalue Reference, the function is free to return large objects, while with resource assignment more efficient, so that the pointer can in any case exit use (except the library)

L Globally unique resources can be encapsulated as only removable non-copy semantics

L Any non-reference data can be a member of a consortium

L final, override, virtual, etc. to indicate the keyword to use frequently

l enum becomes strongly typed and cannot be implicitly converted to a number

L Friend Key Declaration friend class without adding class

L sizeof can be used directly in struct members

Class L can be initialized in place to save code

L Noexcept declares that this function does not throw an exception, and if thrown, it terminate

L added a long long data type that guarantees more than 64 digits

• By customizing the literal, you can get closer to the writing language and even use literal literals as functions

L using broler= int to define type aliases, similar to typedef functions

L Template instantiation >> is used as an end-of-compliance method

L Use Auto to do dynamic type, the maximum application is to define iterator. and using auto-decorated functions can post the return type, you can define the return type directly after the function

L Hash_code is a new member of Rtti

L Decltype enables C + + to finally support the change of new types such as reflection, and it automatically removes the CV qualifier

L for can be used to return, thus can not for_each

The enum class can specify the type of the enumeration and is strongly typed

L Auto_ptr was abandoned, with Unique_ptr, shared_ptr, weak_ptr. Unique_ptr can only be moved, not copied, shared_ptr is a reference count, weak_ptr can point to shared_ptr memory, but the count is unchanged, when the count is 0 o'clock, return nullptr

L C++11 defines garbage collection and allows users to keep specific pointers from being recycled

L CONSTEXPT make the function constant at compile time (for switch, Class)

L can use tuple.

L yard type can be directly used for parallel programming

L Quick_exit can exit quickly and gracefully without the need for destructors

L nullptr (nullptr_t) refers to a null pointer, cannot be implicitly converted to another type, and it is a run-time constant, has an address

L =default, =delete can control the class's default build function

L Lamba for functional programming, = means passing parent domain all by value pass,& represents all reference passing of parent domain, can be used for sub-process collation of large function flow, and catch by value does not change parent value

L Enable auto to get a reference to the Lamba function to implement complex large functions, the greatest benefit is that the code can be refactored inside the function

L use Alignof to determine the alignment number, use the Alignas to reset the alignment direction, to facilitate efficient and loud data processing

l use [[]] to define common properties, should be used as much as possible for code optimization

L \UXXXX can represent 16-bit Unicode

L string with R "" denotes a native string and can be formatted within a string

C++11 Knowledge points

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.