Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
CPlusPlusNotesForProfessionals.pdf
Скачиваний:
47
Добавлен:
20.05.2023
Размер:
5.11 Mб
Скачать

Chapter 63: The ISO C++ Standard

In 1998, the there was a first publication of the standard making C++ an internally standardized language. From that time, C++ has evolved resulting in di erent dialects of C++. On this page, you can find an overview of all di erent standards and their changes compared to the previous version. The details on how to use these features is described on more specialized pages.

Section 63.1: Current Working Drafts

All published ISO standards are available for sale from the ISO store ( http://www.iso.org ). The working drafts of the C++ standards are publicly available for free though.

The di erent versions of the standard:

Upcoming (Sometimes referred as C++20 or C++2a): Current working draft (HTML-version)

Proposed (Sometimes referred as C++17 or C++1z): March 2017 working draft N4659.

C++14 (Sometimes referred as C++1y): November 2014 working draft N4296

C++11 (Sometimes referred as C++0x): February 2011 working draft N3242

C++03

C++98

Section 63.2: C++17

The C++17 standard is feature complete and has been proposed for standardization. In compilers with experimental support for these features, it is usually referred to as C++1z.

Language Extensions

Fold Expressions

declaring non-type template arguments with auto

Guaranteed copy elision

Template parameter deduction for constructors

Structured bindings

Compact nested namespaces

New attributes: [[fallthrough]], [[nodiscard]], [[maybe_unused]]

Default message for static_assert

Initializers in if and switch

Inline variables

if constexpr

Order of expression evaluation guarantees

Dynamic memory allocation for over-aligned data

Library Extensions

std::optional

std::variant

std::string_view

merge() and extract() for associative containers

A file system library with the <filesystem> header.

Parallel versions of most of the standard algorithms (in the <algorithm> header).

Addition of mathematical special functions in the <cmath> header.

Moving nodes between map<>, unordered_map<>, set<>, and unordered_set<>

GoalKicker.com – C++ Notes for Professionals

339

Section 63.3: C++11

The C++11 standard is a major extension to the C++ standard. Below you can find an overview of the changes as they have been grouped on the isocpp FAQ with links to more detailed documentation.

Language Extensions

General Features

auto

decltype

Range-for statement

Initializer lists

Uniform initialization syntax and semantics

Rvalue references and move semantics

Lambdas

noexcept to prevent exception propagation

constexpr

nullptr – a null pointer literal

Copying and rethrowing exceptions

Inline namespaces

User-defined literals

Classes

=default and =delete

Control of default move and copy

Delegating constructors

In-class member initializers

Inherited constructors

Override controls: override

Override controls: final

Explicit conversion operators

Other Types

enum class

long long – a longer integer

Extended integer types

Generalized unions

Generalized PODs

Templates

Extern templates

Template aliases

Variadic templates

Local types as template arguments

Concurrency

Concurrency memory model

Dynamic initialization and destruction with concurrency

Thread-local storage

Miscellaneous Language Features

GoalKicker.com – C++ Notes for Professionals

340

What is the value of __cplusplus for C++11?

Su x return type syntax

Preventing narrowing

Right-angle brackets

static_assert compile-time assertions

Raw string literals

Attributes

Alignment

C99 features

Library Extensions

General

unique_ptr

shared_ptr

weak_ptr

Garbage collection ABI

tuple

Type traits

function and bind

Regular Expressions

Time utilities

Random number generation

Scoped allocators

Containers and Algorithms

Algorithms improvements

Container improvements

unordered_* containers

std::array forward_list

Concurrency

Threads

Mutual exclusion

Locks

Condition variables

Atomics

Futures and promises

async

Abandoning a process

Section 63.4: C++14

The C++14 standard is often referred to as a bugfix for C++11. It contains only a limited list of changes of which most are extensions to the new features in C++11. Below you can find an overview of the changes as they have been grouped on the isocpp FAQ with links to more detailed documentation.

Language Extensions

Binary literals

Generalized return type deduction

GoalKicker.com – C++ Notes for Professionals

341

decltype(auto)

Generalized lambda captures

Generic lambdas

Variable templates

Extended constexpr

The [[deprecated]] attribute

Digit separators

Library Extensions

Shared locking

User-defined literals for std:: types

std::make_unique

Type transformation _t aliases

Addressing tuples by type (e.g. get<string>(t))

Transparent Operator Functors (e.g. greater<>(x))

std::quoted

Deprecated / Removed

std::gets was deprecated in C++11 and removed from C++14

std::random_shuffle is deprecated

Section 63.5: C++98

C++98 is the first standardized version of C++. As it was developed as an extension to C, many of the features which set apart C++ from C are added.

Language Extensions (in respect to C89/C90)

Classes, Derived classes, virtual member functions, const member functions

Function overloading, Operator overloading

Single line comments (Has been introduced in the C-languague with C99 standard)

References

new and delete

boolean type (Has been introduced in the C-languague with C99 standard)

templates

namespaces

exceptions specific casts

Library Extensions

The Standard Template Library

Section 63.6: C++03

The C++03 standard mainly addresses defect reports of the C++98 standard. Apart from these defects, it only adds one new feature.

Language Extensions

Value initalization

GoalKicker.com – C++ Notes for Professionals

342