📜 ⬆️ ⬇️

The road to C ++ 20

image The summer meeting of the ISO WG21 C ++ committee, which took place in Toronto from July 10 to 15, ended today. Soon we will certainly have a detailed report from the WG21 , and today a respected audience is offered a post- “warm-up” with a discussion of the most interesting.

The results of the meeting are as follows: the C ++ 17 standard is completed and will be published at the next meeting in November of this year; The C ++ 20 standard has already acquired the first serious features - concepts ( concepts ), explicit generic lambdas - and this is only the beginning.

The possibilities of the new C ++ 17 standard have already been discussed more than once, innovations have been written on Habré , presentations at conferences , so I’ll not bring them here again. It is no secret that the key feature of this C ++ release was the transfer of the most "tasty" features to the uncertain future. Well, now we can say with confidence that many long-awaited “features” moved in C ++ 20. Taken on stdlib extension has not gone away, so you can expect a much larger and rich set of functions from C ++ 20.

')

Draft Standard C ++ 20


Concepts


The long-suffering Concepts , once not included in C ++ 11, then converted into a new sentence, Concepts-Lite , finally become part of the standard.

For the brief syntax for concepts (terse syntax), the committee has not yet been able to agree; however, the discussion will continue under C ++ 20.

_VA_OPT_


#define LOG(msg, ...) printf(msg __VA_OPT__(,) __VA_ARGS__)

LOG("hello world")   // => printf("hello world")
LOG("hello world", ) // => printf("hello world")
LOG("hello %d", n)   // => printf("hello %d", n)


- (Explicit generic lambdas) [pdf]


[] <typename T> (T t) { /* ... */ }

- C++11, ; C++14 - auto:
[](auto x) { /* ... */ }

( ) — - :

[]<typename T>(T x) { /* ... */ }
[]<typename T>(T* p) { /* ... */ }
[]<typename T, int N>(T (&a)[N]) { /* ... */ }


shared_ptr [pdf]


shared_ptr<double[]> p = make_shared<double[]>(1024);

— , 1.


— , , :
enum class endian
{
  little = __ORDER_LITTLE_ENDIAN__,
  big    = __ORDER_BIG_ENDIAN__,
  native = __BYTE_ORDER__
};


(designated initializer) [pdf]


struct A { int x; int y; int z; }; A b{.x = 1, .z = 2};


(default bit-field initializers)


struct S {int x : 8 = 42;};

, «in-class initialization» C++11: declarator .

const-qualified


struct X { void foo() const&; };
X{}.foo();        // this is okay
(X{}.*&X::foo)(); // ill-formed in C++17, well-formed in C++2a



vector v{vector{1, 2}};
 //  vector<int>  vector<vector<int>>


TS (Technical Specifications)



TS ++17 ( ):


, , ( ):

TS, .
— , , — ++20.

(Modules) [pdf]


- , , — TS . ( ) — .. - Microsoft . , , .

Concurrency v1 [pdf]


, , — TS ++20. , futures ( std::async), latches, atomic smart pointers atomic_shared_ptr. ++17 , .
MS Visual Studio, HPX just::thread. , P0676 P0701 TS .

Transactional Memory v1 [pdf]


, TS , shared_ptr , . , - .

Library Fundamentals v2


. , ++20.

Executors v1 [pdf]


. ++20, .. TS , .

Reflection v1 [pdf]


. ++20, .

TS ( ) (reification). , TS , Boost::Hana — .

Concurrency v2


. concurrent data structures, oncurrent queues, lock-free ; Hazard pointers ( ), RCU ( lock-free ), atomic views. ++20 , .. — , , .

Parallelism v2


. , Parallelism v1 Parallel STL CPU, GPU. Parallelism v2 —

Library Fundamentals v3


.

Contracts v1


. TS, ++20. : assert, - - (.. ). , ++ , , , - .

Numerics [pdf]


. - ++20: decimal floating point, bounded types (, fixed point types), unbounded types, multiprecision arithmetic. (, , , ).

2D Graphics v1


.


std::string — starts_with, ends_with.

, TS . , CUDA/OpenMP/OpenCL C++. , std::invoke, std::async, . , std::thread CPU; , Executors TS , , .

Google, NVidia, Codeplay NASDAQ TS, ++, : Concurrency, Parallelism, Transactional Memory, Networking.

, C++20, .


, .
Michael Wong — What's in C++20 and the C++17 final score card

2017 Toronto ISO C++ Committee Discussion Thread (Concepts in C++20; Coroutines, Ranges and Networking TSes published)
C++17: The Language Features — Nicolai Josuttis
Trip report: Summer ISO C++ standards meeting (Toronto)

Source: https://habr.com/ru/post/333414/


All Articles