More effective C + + clause 35 make yourself accustomed to the standard C + + language

Source: Internet
Author: User
Tags class definition

(Since the book was published in 1996, the new features of the time may now be taken for granted, but now re-understand the role of C + + change)

1. Important changes in C + + after 1990 years

1). Added new language features: rtti,namespaces,bool, keyword mutable and explicit,enums type promotion conversions caused by arguments of overloaded functions, and "Direct Integer (intergral) in class definition area." The const static class members set the initial value "capability.

2). Extended the Templates feature: Allow member templates to exist, accept "understand just template on-the-spot instantiation" of the standard syntax, allow function templates accept "non-type arguments (non-type atguments) ", you can use class templates as an argument to another template.

3). Enhanced exception handling mechanism (Exception handling): More rigorous validation of Exception specifications during compilation, allowing unexcpted functions to throw bad_exception objects.

4). Modified memory allocation routines: If operator new[] and operator delete[], memory fails to allocate successfully by operator New/new[] throws an exception, provides a operator new/new[] new version, Returns 0 after a memory allocation failure.

5). Added a new form of transformation: Static_cast,dynamic_cast,const_cast and Reinterpret_cast

2. The ability of the standard program library

1). Support C standard function library.

2). Support Strings.

3). Support Country (localization, localization). Different cultures use different character sets as well as different dates, times, sorting things, currency values and other explicit customs.

4). Support I/O.

5). Supports numeric applications. Supports complex and array classes, and provides common functions, including partial and partial sum, and adjacent difference (adjacent difference).

3. Standard library Features

1). Highly templated – Almost everything is a template. For example, string is a typedef of basic_string<char> (Basic_string can also support wide Char,unicode char), IOStreams is also a template, which has a type parameter (type parameter) to define the character type of the streams (data stream).

2). All ingredients are located within namespace Std.

4. Standart Template Library (STL)

1). STL occupies the majority of the C + + standard library, consisting mainly of three parts: container (Container), iterator (iterator), and generic Algorithm (algorithm). Where the container holds objects, iterators are used to traverse the container elements, The generic algorithm is based on an iterator implementation that does not depend on a specific type of function template.

2). STL is extensible, as long as you follow the STL standards, you can combine your own containers, iterators, algorithms, etc. with STL. (To make a custom iterator suitable for STL generic algorithms, you need to understand C + + 's traits techniques, see effective C + + clause 47)

More effective C + + clause 35 make yourself accustomed to the standard C + + language

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.